@Override
        protected void invalidated() {

          if (!changeIsLocal) {
            changeIsLocal = true;
            final Color c = get();
            hue.set(c.getHue());
            sat.set(c.getSaturation() * 100);
            bright.set(c.getBrightness() * 100);
            changeIsLocal = false;
          }
        }
示例#2
0
 private void updateSectionColors() {
   int listSize = sections.size();
   sectionColorMap.clear();
   for (int i = 0; i < listSize; i++) {
     Color sectionColor = sections.get(i).getColor();
     Color lcdForegroundColor;
     if (Helper.isMonochrome(sectionColor)) {
       lcdForegroundColor = Helper.isDark(sectionColor) ? Color.WHITE : Color.BLACK;
     } else {
       lcdForegroundColor =
           Color.hsb(
               sectionColor.getHue(),
               sectionColor.getSaturation(),
               sectionColor.getBrightness() * 0.3);
     }
     Color lcdBackgroundColor =
         Color.color(sectionColor.getRed(), sectionColor.getGreen(), sectionColor.getBlue(), 0.1);
     sectionColorMap.put(
         sections.get(i), getSectionColors(lcdBackgroundColor, lcdForegroundColor));
   }
 }
示例#3
0
  private Color[] getSectionColors(
      final Color LCD_BACKGROUND_COLOR, final Color LCD_FOREGROUND_COLOR) {
    double hue = LCD_BACKGROUND_COLOR.getHue();
    double sat = LCD_BACKGROUND_COLOR.getSaturation();

    Color[] colors;
    if (Helper.isMonochrome(LCD_BACKGROUND_COLOR)) {
      // Section color is monochrome
      colors =
          new Color[] {
            Color.hsb(hue, 0, 0.69),
            Color.hsb(hue, 0, 1.0),
            Color.hsb(hue, 0, 0.76),
            Color.hsb(hue, 0, 0.76),
            Color.hsb(hue, sat, 0.69),
            Helper.isDark(LCD_BACKGROUND_COLOR) ? Color.WHITE : Color.BLACK,
            Helper.isDark(LCD_BACKGROUND_COLOR)
                ? Color.rgb(255, 255, 255, 0.1)
                : Color.rgb(0, 0, 0, 0.1)
          };
    } else {
      // Section color is not monochrome
      colors =
          new Color[] {
            Color.hsb(hue, sat, 0.69),
            Color.hsb(hue, sat, 1.0),
            Color.hsb(hue, sat, 0.76),
            Color.hsb(hue, sat, 0.76),
            Color.hsb(hue, sat, 0.69),
            LCD_FOREGROUND_COLOR,
            Color.color(
                LCD_BACKGROUND_COLOR.getRed(),
                LCD_BACKGROUND_COLOR.getGreen(),
                LCD_BACKGROUND_COLOR.getBlue(),
                0.1)
          };
    }
    return colors;
  }