From a28ec7b3c11e7d8aee21bcefa09ba75bea8cff60 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 8 Apr 2005 10:30:43 +0000 Subject: [PATCH] some more useful macros git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3950 212acab6-be3b-0410-9dea-997c60f758d6 --- Include/Colors.nsh | 61 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/Include/Colors.nsh b/Include/Colors.nsh index f27efa99..64ca3a1e 100644 --- a/Include/Colors.nsh +++ b/Include/Colors.nsh @@ -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 \ No newline at end of file +!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 \ No newline at end of file