Modding:Colors & Object Rendering

From Caves of Qud Wiki
Jump to navigation Jump to search
This page is about modding. See the modding overview for an abstract on modding.
This page is about modding. See the modding overview for an abstract on modding.

Overview

Colors are defined in Display.txt.

Each color is defined by a single letter. & means to set the foreground color, ^ means to set the background color.

Code Name Hex
r dark red / crimson #a64a2e
R red / scarlet #d74200
o dark orange #f15f22
O orange #e99f10
w brown #98875f
W gold / yellow #cfc041
g dark green #009403
G green #00c420
b dark blue #0048bd
B blue / azure #0096ff
c dark cyan / teal #40a4b9
C cyan #77bfcf
m dark magenta / purple #b154cf
M magenta #da5bd6
k #0f3b3a
K dark grey / black #155352
y grey #b1c9c3
Y white #ffffff

To get a palette file for these colors, refer to Visual_Style#Palette.

In XML files, such as ObjectBlueprints.xml, the ampersand (&) must be replaced by the encoded ampersand (&)

Prefix Text Xml
Foreground &<code> &amp;<code>
Background ^<code> ^<code>

Render Part

ColorString contains the foreground and (optionally) the background string for the ascii and tiles. Examples: &B or &B^r

TileColor is identical to ColorString, but applies only to tiles. If this is not specified, a tile falls back to using the ColorString.

DetailColor changes the "third" color used only for tiles, not the ascii. DetailColor is always just a single character. Example: g

So ColorString="&M^g" would be foreground bright magenta with a background color of green, Like this!

If you want to color an item's display name, you enter color codes directly in the display name itself, for example the beaded bracelet:

<part Name="Render" DisplayName="&amp;Cb&amp;Be&amp;ba&amp;cd&amp;Ce&amp;Bd&amp;y bracelet" ColorString="&amp;C"></part>

The qud-colorgen utility (created by crayon) is an external tool that can help you create these complex color strings, however the newer Markup language the game uses might be good enough for your purposes.

Note that if a detail color is not specified, it will default to the background viridian color.

Color Markup Language

Most default text in the game is colored grey (&y), so you'll often see an &y at the end of strings to reset the color back to normal. When putting strings using the basic color codes together to make sentences extremely confusing color bleed becomes possible. Because of this there is new system which parses text in double curly braces: {{color|text}}. If you want to ensure colors "return" to what they were set to, you can leave out the color. "{{|&RThis text is red}} and this will be whatever the color was before red"

In general, every string for rendering, except the color string/detail color on render part should use the new Markup language.

Text can also be colored as follows using any of the color templates defined in StreamingAssets\Base\Colors.xml.

{{color template|your text to color here}}

List of possible templates

ShaderColorsType
BBsequence
CCsequence
GGsequence
KKsequence
MMsequence
OOsequence
RRsequence
WWsequence
YYsequence
agolgotK-g-w-m-w-g-Ksequence
amorousr-R-M-malternation
arctic camouflagey-y-Y-y-K-y-y-Y-Y-Ksequence
astralY-y-K-y-Yalternation
auroralK-g-G-Y-G-g-Ksequence
azureBsequence
bbsequence
beeK-w-W-Y-W-w-Kalternation
bethsaidaw-W-C-c-m-c-C-W-wsequence
beylahB-b-g-k-W-R-rsequence
biog-G-W-M-W-G-g-g-g-g-gsequence
biomechw-w-r-r-r-w-r-rsequence
blackKsequence
blazer-r-R-W-Ysequence
blueBsequence
brainbrineg-g-g-w-W-W-W-w-g-g-gsequence
brownwsequence
ccsequence
camouflageg-g-G-g-K-g-g-G-G-Ksequence
chiralB-b-c-C-M-m-k-m-M-C-c-bsequence
ciderrsolid
cloningY-Y-Y-Y-Y-Y-M-Y-M-Y-Y-Y-Y-Y-Ysequence
cloudyy-y-Y-y-Y-Ysequence
coated in plasmaK-K-y-g-G-Y-k-Y-Y-k-Y-G-g-y-K-Ksequence
crimsonrsequence
crochideg-g-g-g-g-Gsequence
cryogenicY-C-C-Y-c-c-K-y-Ysequence
crystallinem-m-m-b-B-Y-B-b-m-m-msequence
crysteely-y-K-g-g-K-y-yalternation
cyanCsequence
dark bluebsequence
dark cyancsequence
dark fieryr-R-W-R-ralternation
dark grayKsequence
dark greengsequence
dark keybindwsequence
dark magentamsequence
dark orangeosequence
dark redrsequence
defoliantW-W-G-g-K-g-Gsequence
desert camouflagew-w-W-w-K-w-w-W-W-Ksequence
displacerb-B-Y-Bsequence
dreamsmokeb-b-b-b-y-Y-Y-W-w-b-b-bsequence
dreamyb-b-b-B-M-k-W-M-B-b-b-b-bsequence
earthb-B-W-g-Gsequence
eaterY-Y-M-Y-Y-Ysequence
ehalcodony-y-Y-Y-m-Y-Y-y-ysequence
electricalWsequence
emotewsolid
engravedY-y-c-Csequence
entropicK-K-m-K-K-K-m-m-K-K-ysequence
extradimensionalM-M-m-m-y-y-Y-Y-O-Y-Y-y-m-m-M-Malternation
featheredC-B-b-g-G-g-b-B-Calternation
fieryRsequence
filthyw-w-K-w-K-w-Wsequence
forestg-g-w-G-g-g-w-w-g-G-G-wsequence
freezingCsequence
fungicideM-M-R-r-K-r-Rsequence
ggsequence
gaslightg-g-w-W-w-g-galternation
ghostlyY-Y-y-y-K-Kalternation
glitteringK-K-y-M-y-K-Ksequence
glotrotK-K-r-R-rsequence
goldWsequence
graffitiedR-r-w-W-Y-y-r-R-W-wsequence
grayysequence
great machinec-c-C-Y-W-k-W-Y-C-c-c-c-csequence
greenGsequence
hologramb-B-C-csequence
hornedy-Wbordered
hotkeyWsolid
hypertractorr-R-W-w-c-C-B-bsequence
hypervelocityr-R-W-Y-W-R-ralternation
icyY-C-B-C-Yalternation
illuminatedc-c-c-C-Y-W-Y-Csequence
implantedr-r-r-r-r-r-r-Csequence
importantWsequence
internalsWsolid
ironshankK-y-Y-ysequence
issachariY-Y-Y-Y-Y-Y-rsequence
jungleg-g-w-G-g-m-g-w-w-K-g-m-G-G-wsequence
kksequence
kaleidoslugK-C-y-m-M-r-c-C-Y-y-Ksequence
kesilm-m-M-Y-ysequence
keybindWsequence
lacqueredY-y-K-y-Y-y-K-y-Y-ysequence
lahw-W-R-rsequence
lanternedy-y-y-y-Y-W-Y-y-yalternation
lavaRsolid
leafyg-g-Gsequence
leopardW-W-w-w-W-K-K-w-w-W-Wsequence
levantr-r-y-y-Y-Ysequence
loveY-R-Y-Ysequence
lovesicknessr-R-M-m-r-R-Msequence
mmsequence
magentaMsequence
mercurialc-c-C-W-Y-W-C-c-calternation
metachromew-W-Y-C-c-c-C-Y-W-walternation
metamorphicy-y-y-Y-Y-Y-M-M-M-m-m-m-msequence
mirrorshadesK-y-Y-Y-y-Ksequence
moonb-B-C-csequence
nanoneuror-R-G-g-K-K-g-G-R-r-gsequence
nanotechK-K-y-Ksequence
nectarW-w-g-Gsequence
nervousg-g-w-W-w-g-gsequence
neutronicB-b-K-y-Ysequence
ninefoldb-Bbordered
normalK-K-y-y-Y-y-y-K-K-y-K-y-Ysequence
normalishy-y-K-y-Y-y-y-y-K-y-Ysequence
oosequence
oliveg-g-G-W-wsequence
opalescentY-y-K-K-y-Ysequence
orangeOsequence
otherpearlM-m-y-Y-O-O-Y-y-m-Msequence
overloadedy-y-w-W-R-W-w-y-yalternation
paintedr-R-W-w-g-G-Bsequence
paisleym-M-Y-M-msequence
palladium meshc-c-c-c-C-W-Y-W-Csequence
patchworkW-w-r-R-W-w-b-B-Wsequence
pearlyY-Y-ysequence
peridotG-g-w-W-Y-W-Gsequence
phase-harmonicY-y-m-y-Ksequence
plaidg-K-G-W-Gsequence
plasmag-G-Y-Y-G-gsequence
plastiferK-y-Y-ysequence
playernotesYsolid
polarizedK-y-Y-y-K-y-Y-y-Kalternation
prismaticr-R-W-G-B-b-msequence
psionicb-B-C-c-b-B-Calternation
psychalfleshw-w-w-r-R-M-M-m-M-M-R-r-w-w-w-wsequence
psymeridianK-K-y-y-y-m-M-M-M-M-m-y-y-y-K-Ksequence
purplemsequence
putridKsolid
qasC-c-msequence
qonm-b-Bsequence
quantumm-m-m-m-m-m-m-Y-Y-Y-Y-Ysequence
rrsequence
radiantr-W-Y-Y-Y-W-rsequence
rainbowr-R-W-G-B-b-malternation
redRsequence
refractivey-Ysequence
rermadonY-G-g-m-m-g-G-Ysequence
resonancec-c-C-C-W-C-C-c-calternation
rocketY-W-R-R-r-yalternation
rubbergumW-W-w-w-y-y-Y-W-Wsequence
rulesCsolid
rustyrsequence
scaledg-G-W-w-g-Gsequence
scarletRsequence
shadey-K-c-b-B-y-C-y-Ksequence
shemeshr-r-R-R-W-W-Ysequence
shimmeringY-Y-y-y-K-K-y-ysequence
shugruithK-y-W-w-m-w-W-y-Ksequence
sicklyg-r-m-w-K-G-g-c-Ksequence
silveryYsequence
skulkb-b-B-b-bsequence
slimygsolid
snail-encrustedw-W-Y-ysequence
snakesking-c-C-Gsequence
soulW-w-c-C-Y-C-c-w-Walternation
sparklingy-y-Ysequence
spaserK-g-G-G-g-Ksequence
sphynxC-c-m-Msequence
spikedR-Ybordered
spring-turretc-c-C-C-y-y-y-y-y-C-C-c-csequence
starryK-Y-K-K-Y-Ksequence
structuralY-y-K-y-Yalternation
sunW-R-Walternation
sunsetb-B-B-M-m-r-R-W-C-C-W-R-r-m-M-B-B-balternation
sunslagr-W-Y-Y-Y-W-rsequence
syphonc-c-c-C-W-Ysequence
tarnishedG-G-gsequence
tartany-K-g-G-K-R-r-K-ysequence
tealcsequence
telemetricK-y-c-C-Y-W-C-c-y-Kalternation
thermoR-R-r-c-b-B-Bsequence
transkineticY-C-C-c-y-K-K-y-R-W-W-Ysequence
turbowK-y-Y-Y-R-rsequence
ubernostrumc-g-G-W-w-c-C-G-g-w-Wsequence
urban camouflagey-y-K-y-K-y-y-K-y-Ksequence
visageR-r-b-B-Y-ysequence
wwsequence
wateryB-C-Y-C-Balternation
whiteYsequence
yysequence
ydfreeholdr-R-k-c-C-W-W-C-c-r-Rsequence
yellowWsequence
zetachromem-M-Y-C-c-c-C-Y-M-malternation

Unique Templates

These shaders do not show up in StreamingAssets\Base\Colors.xml, and do not use any of the standard shader types. Instead, they are defined directly in the C# assembly under ConsoleLib.Console.MarkupShaders.

Shader Description
chaotic Gives each character a random color.
random Gives the entire string a random color.

For both of these shaders, the colors are re-rolled every time the game gets the foreground color of the text. In addition, both of these shaders only use vanilla colors (and their overwrites), modded colors assigned to non-vanilla character codes aren't used.

Anonymous Templates

To create a temporary template, the format is:

{{[color pattern delimited by -] [type]|[text]}}

For example:

{{R-R-R-R-R-M-M sequence|mumble mouth}}

Bear in mind that spaces in text may cause issues. The second 'm' of 'mumble mouth' here will be red, not magenta, as the blank space is in the 'magenta' space.


The list of possible types are:

Type Pattern Example
solid Colors the entire string using only the first color of the pattern. texttexttexttext
sequence Repeats the pattern. texttexttexttext
alternation Stretches the pattern so it fits the entire word. texttexttexttext
bordered Colors the first and last characters using the second color in the pattern, and colors all other characters using the first color of the pattern. texttexttexttext
distribution Colors each character using a random color from the pattern. Not used by any of the vanilla templates.

Custom Colors

To define your own colors, include a file called Display.txt in your mod. Inside it, put the following:

{
    "colors":{
		"X":"FFFFFF"
    }
}

From there, replace X with the character you want to represent your new color, and FFFFFF with the hex code of the new color.

If you want to overwrite a vanilla color, add a new color that uses the same character as the vanilla color you want to overwrite.

You can also add multiple new colors by adding them to the list, as shown here:

    "colors":{
		"X":"FFFFFF",
        "p":"000000"
    }

See Also