Loading ...
Sorry, an error occurred while loading the content.

macro rgb2hex

Expand Messages
  • dgroth@gmx.de
    hello, this is trivial but quite handy in html programming: define-macro rgb2hex set-variable :r @ml enter rgb-value for red set-variable :g @ml enter
    Message 1 of 1 , Aug 23, 2001
    • 0 Attachment
      hello,
      this is trivial but quite handy in html programming:

      define-macro rgb2hex
      set-variable :r @ml "enter rgb-value for red"
      set-variable :g @ml "enter rgb-value for green"
      set-variable :b @ml "enter rgb-value for blue"
      set-variable :hexr &add &div :r 16 1
      set-variable :hexrm &add &mod :r 16 1
      set-variable :hexg &add &div :g 16 1
      set-variable :hexgm &add &mod :g 16 1
      set-variable :hexb &add &div :b 16 1
      set-variable :hexbm &add &mod :b 16 1
      set-variable :hexcodes "|0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|0|"
      ; the next (last) line of the macro is very long and will be broken ...
      1000 ml-write &cat &cat &cat &cat &cat &cat "hex is: #" &lget :hexcodes :hexr &lget :hexcodes :hexrm &lget :hexcodes :hexg &lget :hexcodes :hexgm &lget :hexcodes :hexb &lget :hexcodes :hexbm
      !emacro

      regards,
      Detlef
    Your message has been successfully submitted and would be delivered to recipients shortly.