Color



Text elements and areas defined by rect can be any color you want

Text:

forecolor 1 1 1 1


Areas:
backcolor 0 0 0 1


The values (left to right) mean

RED 0-1
GREEN 0-1
BLUE 0-1

TRANSPARENCY 0-1 (0 means invisible, 1 is solid color)
use values like .5 - .6 -.7 to get transparent text.

alter the values
for example:

forecolor .85 .85 0 .5


you get yellow text and 50% transparency.

(0 0 0 is black, 1 1 1 is white)
Find the right color. Check this site http://linaker-wall.net/Colour/Dynamic_Fmt/Swatch_rgb_percent.htm
(remember: 1 = 100%, .47 = 47%)



addColorRange allows you to display numbers with different
colors depending of the value.
addColorRange 0 50 1 0 0 1

1st number: lowest value of the range.
2nd number: highest value of the range.
3rd number: red (0-1)
4th number: green (0-1)
5th number: blue (0-1)
6th number: transparency (0-1)


example: the following code displays the health value
white 101 or higher
yellow 71 - 100
orange 41 - 70
red 40 or lower
menuDef {
visible 1
rect 300 200 100 100

itemDef {
visible 1
rect 0 0 50 50
ownerdraw CG_PLAYER_HEALTH
// white
forecolor 1 1 1 1
// yellow 71 - 100
addColorRange 71 100 1 1 0 1
// orange 41 - 70
addColorRange 41 70 1 .5 0 1
// red 0 - 40
addColorRange 0 40 1 0 0 1
}

}




color examples:
menuDef {
visible 1
rect 150 200 100 100

itemDef {
visible 1
rect 0 0 50 50
style WINDOW_STYLE_FILLED
backcolor 1 1 1 1
}

itemDef {
visible 1
rect 100 0 50 50
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .8
}

itemDef {
visible 1
rect 200 0 50 50
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .5
}

itemDef {
visible 1
rect 300 0 50 50
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .3
}

}


menuDef {
visible 1
rect 100 200 100 100

itemDef {
visible 1
rect 0 0 50 50
style WINDOW_STYLE_FILLED
backcolor 1 1 0 1
}

itemDef {
visible 1
rect 100 0 50 50
style WINDOW_STYLE_FILLED
backcolor 1 .5 .2 1
}

itemDef {
visible 1
rect 200 0 50 50
style WINDOW_STYLE_FILLED
backcolor .5 .5 .5 1
}

itemDef {
visible 1
rect 300 0 50 50
style WINDOW_STYLE_FILLED
backcolor .2 .5 1 1
}

itemDef {
visible 1
rect 400 0 50 50
style WINDOW_STYLE_FILLED
backcolor .3 .7 .1 1
}

}



menuDef {
visible 1
rect 270 190 100 100

itemDef {
visible 1
rect 0 0 100 50
ownerdraw CG_PLAYER_HEALTH
forecolor 1 1 0 1
}

itemDef {
visible 1
rect 150 0 100 50
ownerdraw CG_PLAYER_ARMOR_VALUE
forecolor 0 1 0 .5
}

itemDef {
visible 1
rect 0 150 100 50
ownerdraw CG_PLAYER_AMMO_VALUE
forecolor 1 1 1 .2
}

}

1 comment:

  1. Does forecolor not work to color the "Timer" item? I can't seem to make it work.

    ReplyDelete