Colors.nsh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. !ifndef COLORS_NSH
  2. !define COLORS_NSH
  3. !verbose push
  4. !verbose 3
  5. # Squad
  6. # Rob Segal
  7. # Joel
  8. # Yathosho
  9. # Predefined HTML Hex colors
  10. !define WHITE "FFFFFF"
  11. !define BLACK "000000"
  12. !define YELLOW "FFFF00"
  13. !define RED "FF0000"
  14. !define GREEN "00FF00"
  15. !define BLUE "0000FF"
  16. !define MAGENTA "FF00FF"
  17. !define CYAN "00FFFF"
  18. # Function to convert red , green and blue integer values to HTML Hex format
  19. !define RGB '!insertmacro rgb2hex'
  20. # Function to convert red, green and blue integer values to Hexadecimal (0xRRGGBB) format
  21. !define HEX '!insertmacro rgb2hex2'
  22. # Function to get the r value from a RGB number
  23. !define GetRvalue '!insertmacro redvalue'
  24. # Function to get the g value from a RGB number
  25. !define GetGvalue '!insertmacro greenvalue'
  26. # Function to get the b value from a RGB number
  27. !define GetBvalue '!insertmacro bluevalue'
  28. # Function to get the r value from a Hex number
  29. !define GetRvalueX '!insertmacro bluevalue'
  30. # Function to get the g value from a Hex number
  31. !define GetGvalueX '!insertmacro greenvalue'
  32. # Function to get the r value from a HEX number
  33. !define GetBvalueX '!insertmacro redvalue'
  34. !macro rgb2hex output R G B
  35. IntFmt "${output}" "%02X" "${R}"
  36. IntFmt "${output}" "${output}%02X" "${G}"
  37. IntFmt "${output}" "${output}%02X" "${B}"
  38. !macroend
  39. !macro rgb2hex2 output R G B
  40. IntFmt "${output}" "%02X" "${B}"
  41. IntFmt "${output}" "${output}%02X" "${G}"
  42. IntFmt "${output}" "${output}%02X" "${R}"
  43. !macroend
  44. !macro redvalue output hexval
  45. StrCpy ${output} ${hexval} 2 0
  46. IntFmt "${output}" "%02i" "0x${output}"
  47. !macroend
  48. !macro greenvalue output hexval
  49. StrCpy ${output} ${hexval} 2 2
  50. IntFmt "${output}" "%02i" "0x${output}"
  51. !macroend
  52. !macro bluevalue output hexval
  53. StrCpy ${output} ${hexval} 2 4
  54. IntFmt "${output}" "%02i" "0x${output}"
  55. !macroend
  56. !verbose pop
  57. !endif