Color text image
Render text into a color image with gradients, outline and shadow: tune font size, weight, line height and padding, choose a transparent, solid or gradient background (with angle and stops), and dial stroke width plus shadow blur and offsets. Layout and draw commands come from local pure logic, the preview is drawn on the page Canvas, and you can download a PNG or copy/download the SVG source and CSS.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Text and styling
Layout estimates and draw commands are produced by local pure logic; the PNG is drawn by the page’s Canvas from those same commands, and nothing is uploaded.
Preview and export
The preview renders the same draw commands on a Canvas; the SVG source and CSS can be copied or downloaded.
The same draw commands rendered as SVG — use Download SVG to save the .svg file.
364 × 1504 / 1<svg xmlns="http://www.w3.org/2000/svg" width="364" height="150" viewBox="0 0 364 150" role="img" aria-label="彩色文字">
<defs>
<linearGradient id="color-text-fill" x1="0" y1="0.5" x2="1" y2="0.5">
<stop offset="0" stop-color="#FF7A00"/>
<stop offset="1" stop-color="#FF0080"/>
</linearGradient>
</defs>
<text font-family="system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif" font-size="72" font-weight="700" text-anchor="middle" dominant-baseline="middle" fill="url(#color-text-fill)">
<tspan x="182" y="75">彩色文字</tspan>
</text>
</svg>.color-text {
display: inline-block;
padding: 32px;
font: 700 72px/1.2 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
background: transparent;
color: transparent;
background-image: linear-gradient(90deg, #FF7A00, #FF0080);
-webkit-background-clip: text;
background-clip: text;
}size=364x150 font=700 72px lineHeight=1.2 padding=32 background=transparent:transparent fill=linear-gradient(90deg, #FF7A00, #FF0080) stroke=none shadow=none text=彩色文字 svgBytes=603
The width is estimated per character (CJK and full-width 1 em, ASCII by empirical width, +4% for bold) rather than measured — pure logic has no access to font metrics. The SVG centers text with text-anchor, so an underestimate never clips it.
What this tool does
- Make a cover image, newsletter header or slide title: dial in the gradient, outline and shadow, then download the PNG.
- When you need vector art, check the “Vector preview (SVG)” block, then download the .svg — or copy the generated CSS (the background-clip: text recipe) for a web heading.
- Produce a batch of images from the same phrase: with fixed options the width estimate and canvas size are deterministic, so multiple images line up.
Example
Input
彩色文字 / 72px / weight 700 / transparent background / text gradient 90° #FF7A00 → #FF0080
Output
size=364x150 font=700 72px lineHeight=1.2 padding=32 background=transparent:transparent fill=linear-gradient(90deg, #FF7A00, #FF0080) stroke=none shadow=none text=彩色文字 svgBytes=603
Canvas width = estimated text width 300 + 2 × padding 32 = 364, and the exported SVG starts with <svg ... width="364" height="150" ...>.
Frequently asked questions
How is the text width calculated — is it accurate?
It is estimated per character: CJK and full-width characters count 1 em, ASCII uses an empirical width per class (about 0.28 em for i / l, 0.9 em for m, 0.56 em for digits), plus 4% when the weight is 600 or higher. Pure logic has no access to system font metrics, so this is an estimate, not a measured width; the SVG centers text with text-anchor="middle" so an underestimate never clips it.
How is the PNG exported — is anything uploaded?
Nothing is uploaded. Both the preview and the PNG are rendered in your browser on a Canvas from the same draw commands (gradients, outline and shadow all use native Canvas APIs); exporting converts the canvas to a PNG blob and downloads it as color-text.png.
What is the difference between the SVG and the CSS?
The SVG is vector source that writes your font stack verbatim, so rendering elsewhere depends on that font being installed. The CSS targets web headings: gradient text via background-clip: text, outline via -webkit-text-stroke, shadow via text-shadow.
How are the gradient angles interpreted?
With the CSS linear-gradient convention: 0° points up, 90° right, 180° down. In SVG they become objectBoundingBox x1/y1/x2/y2 values, and on Canvas the gradient line runs through the canvas center with the projected length — both point the same way.
What does this tool deliberately not do?
No font subsetting or font embedding (the SVG only names the font), no rich text or automatic line wrapping (lines break only where you press Enter), no ICC color management or print color conversion, and it never fetches fonts or assets from the network.
How many previews are on the page?
Two: the Canvas preview draws the PNG source from the same commands, and the vector preview renders the generated SVG inline. They match in colour and direction, and the export buttons write color-text.png and color-text.svg.
Keywords:color text generatorgradient texttext outline shadow