Advanced usage of the
Color()
formula [Back to index]
Disclaimer: this functionality is very likely to change in the near future.
The Color()
formula is implemented in a very interesting way, which allows this formula for more than just changing the font color.
You can use special keywords, combined with spaces, to change the text even more.
For example, you can create red text on a green background by using
_Color('kr-green-light-bg kr-red-dark-fg',"Text")
Unfortunately, this does not work with the hex colors.
List of keywords:
- kr-[color class]-fg – changes font color
- kr-[color class]-bg – highlights the text with given color
- kr-highlight – highlights the text in yellow (
#fff59d
, color which isn’t achievable with a color class) - kr-[color class]-interactive-text – changes font color and makes it react to mouse events
- kr-[color class]-interactive – highlights the text with given color and makes it react to mouse events
- kr-bold – makes the text bold
- kr-italic – makes the text italic
- kr-underline – adds an underline to the text
- kr-line-through – adds a strike-through to the text
Nesting
Unlike other text formatting functions, this one doesn’t allow for nesting.
The outer Color()
formula will completely overwrite all other Color()
formulas.
This means that while
_Bold(_Italicize("Text"))
creates text that is both bold and italic,
_Color('kr-bold',_Color('kr-italic',"Text"))
will create text which is only bold.
This also means that partially overlapping formats like
_Bold("Partially ",_Italicize("Italic"))
have to be split into
Concatenate(
_Color("kr-bold", "Partially "),
_Color("kr-bold kr-italic","Italic")
)