home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Programming / nsis-2.46-setup.exe / Include / Colors.nsh next >
Encoding:
Text File  |  2007-12-01  |  1.8 KB  |  75 lines

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