Method 1: CSS style Attribute ⚓︎
1 | <!-- Basic Usage: Set font color --> |
Preview:
This text is red
This text is dark blue (Dodger Blue)
This text is orange
This text is semi-transparent green
This purple text is bold
Screen Color PickerIf you need color codes in HEX, RGB, RGBA, HSL, HSLA, HSV, HSVA, CMYK, CMYKA formats for a specific color, you can extract them using the tool below.
Method 2: JavaScript Script ⚓︎
Create a folder named scripts in the Hexo root directory, create a JavaScript file named color-text.js inside the folder, and paste the code below into it. Or click Download the color-text.js file.
1 | hexo.extend.tag.register('color', function (args, content) { |
You can use it in Markdown as follows:
1 | {% color red %}This text is red{% endcolor %} |
Preview:
This text is red This text is pink This text is greenExtension: Support dual parameters for color + font size (Download the color-text-extension.js file.)
1 | hexo.extend.tag.register('color', function (args, content) { |
Usage Format:
1 | {% color red 27px %}This text is red with font size 27px{% endcolor %} |
Preview:
This text is red with font size 27pxAll articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.
Comments





