summaryrefslogtreecommitdiff
path: root/Include/Colors.nsh
blob: bf09269fa159ed2bd2360ed34e0def3c9b517d57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
!ifndef COLORS_NSH
!define COLORS_NSH

!verbose push
!verbose 3

# Squad
# Rob Segal
# Joel
# Yathosho


# Predefined HTML Hex colors
!define WHITE "FFFFFF"
!define BLACK "000000"
!define YELLOW "FFFF00"
!define RED "FF0000"
!define GREEN "00FF00"
!define BLUE "0000FF"
!define MAGENTA "FF00FF"
!define CYAN "00FFFF"

# Function to convert red , green and blue integer values to HTML Hex format
!define RGB '!insertmacro rgb2hex'

# Function to convert red, green and blue integer values to Hexadecimal (0xRRGGBB) format
!define HEX '!insertmacro rgb2hex2'

# Function to get the r value from a RGB number
!define GetRvalue '!insertmacro redvalue'

# Function to get the g value from a RGB number
!define GetGvalue '!insertmacro greenvalue'

# Function to get the b value from a RGB number
!define GetBvalue '!insertmacro bluevalue'

# Function to get the r value from a Hex number
!define GetRvalueX '!insertmacro bluevalue'

# Function to get the g value from a Hex number
!define GetGvalueX '!insertmacro greenvalue'

# Function to get the r value from a HEX number
!define GetBvalueX '!insertmacro redvalue'

!macro rgb2hex output R G B
IntFmt "${output}" "%02X" "${R}"
IntFmt "${output}" "${output}%02X" "${G}"
IntFmt "${output}" "${output}%02X" "${B}"
!macroend

!macro rgb2hex2 output R G B
IntFmt "${output}" "%02X" "${B}"
IntFmt "${output}" "${output}%02X" "${G}"
IntFmt "${output}" "${output}%02X" "${R}"
!macroend

!macro redvalue output hexval
StrCpy ${output} ${hexval} 2 0
IntFmt "${output}" "%02i" "0x${output}"
!macroend

!macro greenvalue output hexval
StrCpy ${output} ${hexval} 2 2
IntFmt "${output}" "%02i" "0x${output}"
!macroend

!macro bluevalue output hexval
StrCpy ${output} ${hexval} 2 4
IntFmt "${output}" "%02i" "0x${output}"
!macroend

!verbose pop
!endif