Commit 2bbf13cc3daf5cb4982d121a1c7f55d7679ca566

Authored by Julien Verneuil
1 parent 70a6cd14

added file/function to format rgba color to css style color

Showing 1 changed file with 18 additions and 0 deletions   Show diff stats
web/CXM_style_tools.anubis 0 → 100644
  1 +public define String
  2 + format_rgba_to_style_color
  3 + (
  4 + RGBA color
  5 + ) =
  6 + if color is
  7 + {
  8 + rgba(r, g, b, a) then
  9 + with alpha_str =
  10 + if to_Float(word32(word16(a, 0), word16(0, 0))) / 255.0 is
  11 + {
  12 + failure then "1",
  13 + success(v) then
  14 + float_to_string(v, 8)
  15 + },
  16 +
  17 + "rgba(" + to_decimal(r) + "," + to_decimal(g) + "," + to_decimal(b) + "," + alpha_str + ");"
  18 + }.