Gets the computed background color, based on the backgroundColor CSS
class.
491143
protected void setupComputedBackgroundColor() {
        // temp is just a widget created to evaluate the computed background
        // color
        MaterialWidget temp = new MaterialWidget(Document.get().createDivElement());
        temp.setBackgroundColor(backgroundColor);

        // setting a style to make it invisible for the user
        Style style = temp.getElement().getStyle();
        style.setPosition(Position.FIXED);
        style.setWidth(1, Unit.PX);
        style.setHeight(1, Unit.PX);
        style.setLeft(-10, Unit.PX);
        style.setTop(-10, Unit.PX);
        style.setZIndex(-10000);

        // adding it to the body (on Chrome the component must be added to the
        // DOM before getting computed values).
        String computed = ColorHelper.setupComputedBackgroundColor(backgroundColor);

        // convert rgb to rgba, considering the opacity field
        if (opacity < 1 && computed.startsWith("rgb(")) {
            computed = computed.replace("rgb(", "rgba(").replace(")", ", " + opacity + ")");
        }

        computedBackgroundColor = computed;
    }
443967
def _background_color(s):
        
        seed(s)
        r = v = b = 255
        while r + v + b > 255 * 2:
            r = randint(0, 255)
            v = randint(0, 255)
            b = randint(0, 255)
        return (r, v, b)
529914
private static boolean isTransparent(String backgroundColor) {

        // not only check 'transparent' but also 'rgba(0, 0, 0, 0)' as returned by chrome
        return StyleValue.transparent.toString().equalsIgnoreCase(backgroundColor)
            || "rgba(0, 0, 0, 0)".equalsIgnoreCase(backgroundColor);
    }
1277546
function getRgbAColor(color, opacity) {
  const id = color + '&' + opacity;
  if (colorCache[id]) {
    return colorCache[id];
  }

  const div = document.createElement('div');
  div.style.background = color;
  document.body.appendChild(div);
  const computedColor = window.getComputedStyle(div).backgroundColor;
  document.body.removeChild(div);

  /* istanbul ignore if */
  if (!rgbReg.test(computedColor)) {
    return color;
  }

  return (colorCache[id] = `rgba(${
    extractRgbColor.exec(computedColor)[1]
  }, ${opacity})`);
}
582144
private void obtainPreviewBackground(@NonNull final TypedArray typedArray) {
        int backgroundColor = typedArray
                .getColor(R.styleable.AbstractColorPickerPreference_previewBackground, -1);

        if (backgroundColor != -1) {
            setPreviewBackgroundColor(backgroundColor);
        } else {
            int resourceId = typedArray
                    .getResourceId(R.styleable.AbstractColorPickerPreference_previewBackground,
                            R.drawable.color_picker_default_preview_background);
            setPreviewBackground(ContextCompat.getDrawable(getContext(), resourceId));
        }
    }
355404
protected String getCssClass(final String name) {
        var computedCssClass = "fa fa-lock";
        if (StringUtils.isNotBlank(name)) {
            computedCssClass = computedCssClass.concat(' ' + PAC4J_CLIENT_CSS_CLASS_SUBSTITUTION_PATTERN.matcher(name).replaceAll("-"));
        }
        LOGGER.debug("CSS class for [{}] is [{}]", name, computedCssClass);
        return computedCssClass;
    }
427426
def console_get_background_flag(con: tcod.console.Console) -> int:
    
    return int(lib.TCOD_console_get_background_flag(_console(con)))
1232413
def get_colors(self, prefix, len_):
        """"""

        def color(tupl):
            """Make a color css"""
            return ((
                '%s.color-{0}, %s.color-{0} a:visited {{\n'
                '  stroke: {1};\n'
                '  fill: {1};\n'
                '}}\n'
            ) % (prefix, prefix)).format(*tupl)

        def value_color(tupl):
            """Make a value color css"""
            return ((
                '%s .text-overlay .color-{0} text {{\n'
                '  fill: {1};\n'
                '}}\n'
            ) % (prefix, )).format(*tupl)

        def ci_color(tupl):
            """Make a value color css"""
            if not tupl[1]:
                return ''
            return (('%s .color-{0} .ci {{\n'
                     '  stroke: {1};\n'
                     '}}\n') % (prefix, )).format(*tupl)

        if len(self.colors) < len_:
            missing = len_ - len(self.colors)
            cycles = 1 + missing // len(self.colors)
            colors = []
            for i in range(0, cycles + 1):
                for color_ in self.colors:
                    colors.append(darken(color_, 33 * i / cycles))
                    if len(colors) >= len_:
                        break
                else:
                    continue
                break
        else:
            colors = self.colors[:len_]

        # Auto compute foreground value color when color is missing
        value_colors = []
        for i in range(len_):
            if i < len(self.value_colors) and self.value_colors[i] is not None:
                value_colors.append(self.value_colors[i])
            else:
                value_colors.append(
                    'white' if is_foreground_light(colors[i]) else 'black'
                )

        return '\n'.join(
            chain(
                map(color, enumerate(colors)),
                map(value_color, enumerate(value_colors)),
                map(ci_color, enumerate(self.ci_colors))
            )
        )
84780
function getColor(varName, mappings) {
  const color = mappings[varName];
  if (color in mappings) {
    return getColor(color, mappings);
  } else {
    return color;
  }
}
148708
public int color(Context ctx) {
        if (mColorInt == 0 && mColorRes != -1) {
            mColorInt = ContextCompat.getColor(ctx, mColorRes);
        }
        return mColorInt;
    }
978139
public static int getThemeColorFromAttrOrRes(Context ctx, @AttrRes int attr, @ColorRes int res) {
        int color = getThemeColor(ctx, attr);
        if (color == 0) {
            color = ResourcesCompat.getColor(ctx.getResources(), res, ctx.getTheme());
        }
        return color;
    }
380125
def css(self):
        """"""
        return (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / \
               ((self.table[0, 0] + self.table[0, 1]) * (self.table[1, 0] + self.table[1, 1]))
165062
function getColorSeverity(severity) {
    // get the color associated with the severity level
    const color = severityMap[severity] || 'white';
    return chalk[color].bold(severity.toUpperCase());
}
639667
private void obtainBreadCrumbBackgroundColor() {
        int color;

        try {
            color = ThemeUtil.getColor(this, R.attr.breadCrumbBackgroundColor);
        } catch (NotFoundException e) {
            color = ContextCompat.getColor(this, R.color.bread_crumb_background_light);
        }

        setBreadCrumbBackgroundColor(color);
    }
1269350
def getCurrentFadeColor(self, bBackground):
        """"""

        fn = self.function_table.getCurrentFadeColor
        result = fn(bBackground)
        return result
87926
function computeStyle(elem, prop) {
        if (!win.getComputedStyle) {
          win.getComputedStyle = function(el, pseudo) {
            this.el = el;
            this.getPropertyValue = function(prop) {
              var re = /(\-([a-z]){1})/g;
              if (prop == 'float') prop = 'styleFloat';
              if (re.test(prop)) {
                prop = prop.replace(re, function() {
                  return arguments[2].toUpperCase();
                });
              }
              return el.currentStyle && el.currentStyle[prop] ? el.currentStyle[prop] : null;
            };
            return this;
          };
        }

        return win.getComputedStyle(elem, null).getPropertyValue(prop);
      }
22787
public static int getThemeColor(Context ctx, @AttrRes int attr) {
        TypedValue tv = new TypedValue();
        if (ctx.getTheme().resolveAttribute(attr, tv, true)) {
            return tv.resourceId != 0 ? ContextCompat.getColor(ctx, tv.resourceId) : tv.data;
        }
        return 0;
    }