How to use the color.rgb function in color

To help you get started, we’ve selected a few color examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Bastl34 / node-yeelight-wifi / yeelight.js View on Github external
updateCT(ct, bright)
    {
        //ct values: 1700 to 6500
        let rgb = colorTemp.temp2rgb(parseInt(ct));
        let hsv = Color.rgb(rgb).hsv();

        this.rgb.r = rgb[0];
        this.rgb.g = rgb[1];
        this.rgb.b = rgb[2];

        if (typeof bright !== 'undefined' && bright != "")
            this.bright = parseInt(bright);

        this.hsb.h = hsv.color[0];
        this.hsb.s = hsv.color[1];
        this.hsb.b = this.bright;

        //console.log("updateCT => new rgb: ",this.rgb);
        this.emit('stateUpdate',this);
    }
github patternplate / patternplate / components / legacy / src / themes / index.js View on Github external
const backgroundSecondaryLight = ui.colorBackgroundSecondaryLight
    ? color(ui.colorBackgroundSecondaryLight)
    : color.rgb(246, 248, 250);

  const backgroundTertiaryLight = ui.colorBackgroundTertiaryLight
    ? color(ui.colorBackgroundTertiaryLight)
    : color.rgb(246, 248, 250);

  const borderLight = ui.colorBorderLight
    ? color(ui.colorBorderLight)
    : color.rgb(228, 228, 228);

  const colorLight = ui.colorTextLight
    ? color(ui.colorTextLight)
    : color.rgb(68, 68, 68, 1);

  const colorLightNegated = ui.colorTextLightNegated
    ? color(ui.colorTextLightNegated)
    : color.rgb(238, 238, 238);

  const colorRecessLight = ui.colorRecessLight
    ? color(ui.colorRecessLight)
    : color.rgb(106, 115, 125, 1);

  const fontFaces = fonts();

  const common = {
    colors: {
      active: active.string(),
      error: error.string(),
      warning: warning.string(),
github patternplate / patternplate / components / legacy / src / themes / index.js View on Github external
const textColorNegated = ui.colorTextNegatedDark
    ? color(ui.colorTextNegatedDark)
    : colorGroups.gray[700];

  const recess = ui.colorRecessDark
    ? color(ui.colorRecessDark)
    : colorGroups.gray[400];

  const backgroundLight = ui.colorBackgroundLight
    ? color(ui.colorBackgroundLight)
    : color.hsl(255, 0, 100);

  const backgroundSecondaryLight = ui.colorBackgroundSecondaryLight
    ? color(ui.colorBackgroundSecondaryLight)
    : color.rgb(246, 248, 250);

  const backgroundTertiaryLight = ui.colorBackgroundTertiaryLight
    ? color(ui.colorBackgroundTertiaryLight)
    : color.rgb(246, 248, 250);

  const borderLight = ui.colorBorderLight
    ? color(ui.colorBorderLight)
    : color.rgb(228, 228, 228);

  const colorLight = ui.colorTextLight
    ? color(ui.colorTextLight)
    : color.rgb(68, 68, 68, 1);

  const colorLightNegated = ui.colorTextLightNegated
    ? color(ui.colorTextLightNegated)
    : color.rgb(238, 238, 238);
github reflex-ui / reflex-ui / packages / core / src / styles / themes / PurpleTealTheme.tsx View on Github external
const getHoveredDefaultContainerStyle: ViewStyleGetter = ({
  colorTheme,
  theme,
}) => ({
  backgroundColor: Color.rgb(getThemedColor({ colorTheme, theme }))
    .fade(0.94)
    .toString(),
});
github roberth26 / wp-react / src / dataTypes / Color.ts View on Github external
toCss( hsl?: boolean ): string {
		const color = ColorUtils.rgb( this.toArray() );

		return hsl ? color.hsl().string() :	color.string();
	}
github patternplate / patternplate / components / next-generation / themes / src / themes.ts View on Github external
const backgroundSecondaryLight = ui.colorBackgroundSecondaryLight
    ? Color(ui.colorBackgroundSecondaryLight)
    : Color.rgb(246, 248, 250);

  const backgroundTertiaryLight = ui.colorBackgroundTertiaryLight
    ? Color(ui.colorBackgroundTertiaryLight)
    : Color.rgb(246, 248, 250);

  const borderLight = ui.colorBorderLight
    ? Color(ui.colorBorderLight)
    : Color.rgb(228, 228, 228);

  const colorLight = ui.colorTextLight
    ? Color(ui.colorTextLight)
    : Color.rgb(68, 68, 68, 1);

  const colorLightNegated = ui.colorTextNegatedLight
    ? Color(ui.colorTextNegatedLight)
    : Color.rgb(238, 238, 238);

  const colorRecessLight = ui.colorRecessLight
    ? Color(ui.colorRecessLight)
    : Color.rgb(106, 115, 125, 1);

  const backgroundNote = ui.colorBackgroundNote
    ? Color(ui.colorBackgroundNote)
    : backgroundSecondary;

  const backgroundInfoNote = ui.colorBackgroundInfoNote
    ? Color(ui.colorBackgroundInfoNote)
    : info;
github firsttris / homebridge-hyperion-light / hyperion.js View on Github external
function extractColorFromData (data) {
    if (lightState) {
        selectedColor = color.rgb(data.info.activeLedColor[0]["RGB Value"]);
    }
}
function getOn (callback) {
github sasha240100 / between.js / plugins / dom-color.js View on Github external
interpolate(startValue, destValue, progress, data) {
    const r = lerp(startValue.color[0], destValue.color[0], progress);
    const g = lerp(startValue.color[1], destValue.color[1], progress);
    const b = lerp(startValue.color[2], destValue.color[2], progress);
    const a = lerp(startValue.valpha, destValue.valpha, progress);

    const color = Color.rgb(r, g, b, a)[data.format === 'rgba' ? 'rgb' : data.format]();

    return typeof color === 'string' ? color : color.string();
  }
};
github atanasster / grommet-nextjs / components / themes / theme.ts View on Github external
colors: {},
      elevation: {},
      drop: {},
    },
    layer: {},
    checkBox: {},
    anchor: {},
    heading: {},
    radioButton: {},
  };
  const brandRGB = parseRGBString(color);
  const backgroundRGB = parseRGBString(backgroundColor);

  if (brandRGB && backgroundRGB) {
    const bgColor = Color.rgb(backgroundRGB[0], backgroundRGB[1], backgroundRGB[2]);
    const brandColor = Color.rgb(brandRGB[0], brandRGB[1], brandRGB[2]);
    let isDarkBrand;
    let isDarkBackground;
    try {
      isDarkBackground = colorIsDark(backgroundColor);
      isDarkBrand = colorIsDark(color);
    } catch (e) {
      return result;
    }
    let softerBackground;
    let textColor;
    if (isDarkBackground) {
      textColor = parseRGBString('#ebebeb');
      softerBackground = bgColor.lighten(0.05);
    } else {
      textColor = parseRGBString('#444444');
      softerBackground = bgColor.darken(0.05);