some more useful macros

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3950 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2005-04-08 10:30:43 +00:00
parent b43ab07a9b
commit a28ec7b3c1

View file

@ -1,7 +1,16 @@
!ifndef COLORS_NSH
!define COLORS_NSH
!verbose push
!verbose 3
# Squad
# Rob Segal
# Lobo Lunar
# Joel
# Yathosho
# Predefined HTML Hex colors
!define WHITE "FFFFFF"
!define BLACK "000000"
!define YELLOW "FFFF00"
@ -11,8 +20,56 @@
!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
!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