CustomUI - discussion thread

@andrey The problem is that hs_color does not accurately map to rgb_color. We also need to add brightness. Here’s what I am using currently:

sensor.*_futures_change_pct:
  templates:
    hs_color: >
      if (state < -4) return [360, 85];
      if (state < -2) return [23, 90];
      if (state < 0) return [50,100];
      if (state < 2) return [65,85];
      if (state < 4) return [100,65];
      return [150,95];
    brightness: >
      if (state < -4) return 216;
      if (state < -2) return 255;
      if (state < 0) return 255;
      if (state < 2) return 220;
      if (state < 4) return 192;
      return 153;

I used the following to obtain the colors (converted RGB into Hue, sat, brightness using http://colorizer.org/ and scaled the brightness to 0-255 based on @NovapaX suggestion)

First, it is definitely less elegant than using rgb_color. More importantly, the colors are not accurately rendered. Here’s the output:

image

The color is #E1F224, which is equivalent to HSB values of 64.95, 85.12, and 94.9 (or a scaled value of 241.995).

3 Likes