Init the Curses color layout.
487657
def _init_colors(self):
        """"""

        # Set curses options
        try:
            if hasattr(curses, 'start_color'):
                curses.start_color()
            if hasattr(curses, 'use_default_colors'):
                curses.use_default_colors()
        except Exception as e:
            logger.warning('Error initializing terminal color ({})'.format(e))

        # Init colors
        if self.args.disable_bold:
            A_BOLD = 0
            self.args.disable_bg = True
        else:
            A_BOLD = curses.A_BOLD

        self.title_color = A_BOLD
        self.title_underline_color = A_BOLD | curses.A_UNDERLINE
        self.help_color = A_BOLD

        if curses.has_colors():
            # The screen is compatible with a colored design
            if self.is_theme('white'):
                # White theme: black ==> white
                curses.init_pair(1, curses.COLOR_BLACK, -1)
            else:
                curses.init_pair(1, curses.COLOR_WHITE, -1)
            if self.args.disable_bg:
                curses.init_pair(2, curses.COLOR_RED, -1)
                curses.init_pair(3, curses.COLOR_GREEN, -1)
                curses.init_pair(4, curses.COLOR_BLUE, -1)
                curses.init_pair(5, curses.COLOR_MAGENTA, -1)
            else:
                curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_RED)
                curses.init_pair(3, curses.COLOR_WHITE, curses.COLOR_GREEN)
                curses.init_pair(4, curses.COLOR_WHITE, curses.COLOR_BLUE)
                curses.init_pair(5, curses.COLOR_WHITE, curses.COLOR_MAGENTA)
            curses.init_pair(6, curses.COLOR_RED, -1)
            curses.init_pair(7, curses.COLOR_GREEN, -1)
            curses.init_pair(8, curses.COLOR_BLUE, -1)

            # Colors text styles
            if curses.COLOR_PAIRS > 8:
                try:
                    curses.init_pair(9, curses.COLOR_MAGENTA, -1)
                except Exception:
                    if self.is_theme('white'):
                        curses.init_pair(9, curses.COLOR_BLACK, -1)
                    else:
                        curses.init_pair(9, curses.COLOR_WHITE, -1)
                try:
                    curses.init_pair(10, curses.COLOR_CYAN, -1)
                except Exception:
                    if self.is_theme('white'):
                        curses.init_pair(10, curses.COLOR_BLACK, -1)
                    else:
                        curses.init_pair(10, curses.COLOR_WHITE, -1)

                self.ifWARNING_color2 = curses.color_pair(9) | A_BOLD
                self.ifCRITICAL_color2 = curses.color_pair(6) | A_BOLD
                self.filter_color = curses.color_pair(10) | A_BOLD

            self.no_color = curses.color_pair(1)
            self.default_color = curses.color_pair(3) | A_BOLD
            self.nice_color = curses.color_pair(9)
            self.cpu_time_color = curses.color_pair(9)
            self.ifCAREFUL_color = curses.color_pair(4) | A_BOLD
            self.ifWARNING_color = curses.color_pair(5) | A_BOLD
            self.ifCRITICAL_color = curses.color_pair(2) | A_BOLD
            self.default_color2 = curses.color_pair(7)
            self.ifCAREFUL_color2 = curses.color_pair(8) | A_BOLD

        else:
            # The screen is NOT compatible with a colored design
            # switch to B&W text styles
            self.no_color = curses.A_NORMAL
            self.default_color = curses.A_NORMAL
            self.nice_color = A_BOLD
            self.cpu_time_color = A_BOLD
            self.ifCAREFUL_color = curses.A_UNDERLINE
            self.ifWARNING_color = A_BOLD
            self.ifCRITICAL_color = curses.A_REVERSE
            self.default_color2 = curses.A_NORMAL
            self.ifCAREFUL_color2 = curses.A_UNDERLINE
            self.ifWARNING_color2 = A_BOLD
            self.ifCRITICAL_color2 = curses.A_REVERSE
            self.filter_color = A_BOLD

        # Define the colors list (hash table) for stats
        self.colors_list = {
            'DEFAULT': self.no_color,
            'UNDERLINE': curses.A_UNDERLINE,
            'BOLD': A_BOLD,
            'SORT': A_BOLD,
            'OK': self.default_color2,
            'MAX': self.default_color2 | curses.A_BOLD,
            'FILTER': self.filter_color,
            'TITLE': self.title_color,
            'PROCESS': self.default_color2,
            'STATUS': self.default_color2,
            'NICE': self.nice_color,
            'CPU_TIME': self.cpu_time_color,
            'CAREFUL': self.ifCAREFUL_color2,
            'WARNING': self.ifWARNING_color2,
            'CRITICAL': self.ifCRITICAL_color2,
            'OK_LOG': self.default_color,
            'CAREFUL_LOG': self.ifCAREFUL_color,
            'WARNING_LOG': self.ifWARNING_color,
            'CRITICAL_LOG': self.ifCRITICAL_color,
            'PASSWORD': curses.A_PROTECT
        }
1168919
private void initCss() {

        I_CmsLayoutBundle.INSTANCE.galleryDialogCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.galleryResultItemCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.listTreeCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.previewDialogCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.croppingDialogCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.imageEditorFormCss().ensureInjected();
        I_CmsLayoutBundle.INSTANCE.imageAdvancedFormCss().ensureInjected();
    }
1140920
function init(l) {

    l
      .attr("opacity", 0)
      .style("stroke-width",0)
      .style("stroke",vars.background.value)
      .style("fill","none");
  }
666324
protected void initDecorations() {
		for (int x = 0; x < 7; x++) {
			days[x].setContentAreaFilled(decorationBackgroundVisible);
			days[x].setBorderPainted(decorationBordersVisible);
			days[x].invalidate();
			days[x].repaint();
			weeks[x].setContentAreaFilled(decorationBackgroundVisible);
			weeks[x].setBorderPainted(decorationBordersVisible);
			weeks[x].invalidate();
			weeks[x].repaint();
		}
	}
1370906
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircularSlider, defStyleAttr, 0);

        // read all available attributes
        float startAngle = a.getFloat(R.styleable.CircularSlider_start_angle, (float) Math.PI / 2);
        float angle = a.getFloat(R.styleable.CircularSlider_angle, (float) Math.PI / 2);
        int thumbSize = a.getDimensionPixelSize(R.styleable.CircularSlider_thumb_size, 50);
        int thumbColor = a.getColor(R.styleable.CircularSlider_thumb_color, Color.GRAY);
        int borderThickness = a.getDimensionPixelSize(R.styleable.CircularSlider_border_thickness, 20);
        int borderColor = a.getColor(R.styleable.CircularSlider_border_color, Color.RED);
        String borderGradientColors = a.getString(R.styleable.CircularSlider_border_gradient_colors);
        Drawable thumbImage = a.getDrawable(R.styleable.CircularSlider_thumb_image);

        // save those to fields (really, do we need setters here..?)
        setStartAngle(startAngle);
        setAngle(angle);
        setBorderThickness(borderThickness);
        setBorderColor(borderColor);
        if (borderGradientColors != null) {
            setBorderGradientColors(borderGradientColors.split(";"));
        }
        setThumbSize(thumbSize);
        setThumbImage(thumbImage);
        setThumbColor(thumbColor);

        // assign padding - check for version because of RTL layout compatibility
        int padding;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            int all = getPaddingLeft() + getPaddingRight() + getPaddingBottom() + getPaddingTop() + getPaddingEnd() + getPaddingStart();
            padding = all / 6;
        } else {
            padding = (getPaddingLeft() + getPaddingRight() + getPaddingBottom() + getPaddingTop()) / 4;
        }
        setPadding(padding);

        a.recycle();
    }
854411
private void initGraphics() {
        // Set initial size
        if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
            Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
            if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
                gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
            } else {
                gauge.setPrefSize(preferredWidth, preferredHeight);
            }
        }

        barBorder1 = new Line();
        barBorder2 = new Line();

        barBackground = new Rectangle();

        ticksAndSectionsCanvas = new Canvas(preferredWidth, preferredHeight);
        ticksAndSections       = ticksAndSectionsCanvas.getGraphicsContext2D();

        ledCanvas = new Canvas();
        led       = ledCanvas.getGraphicsContext2D();
        Helper.enableNode(ledCanvas, gauge.isLedVisible());

        lcd = new Rectangle(0.3 * preferredWidth, 0.014 * preferredHeight);
        lcd.setArcWidth(0.0125 * preferredHeight);
        lcd.setArcHeight(0.0125 * preferredHeight);
        lcd.relocate((preferredWidth - lcd.getWidth()) * 0.5, 0.44 * preferredHeight);
        Helper.enableNode(lcd, gauge.isLcdVisible() && gauge.isValueVisible());

        bar = new Rectangle();
        bar.setStroke(null);

        barHighlight = new Rectangle();
        barHighlight.setStroke(null);
        Helper.enableNode(barHighlight, gauge.isBarEffectEnabled());

        titleText = new Text(gauge.getTitle());
        titleText.setFill(gauge.getTitleColor());
        Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

        unitText  = new Text(gauge.getUnit());
        unitText.setFill(gauge.getUnitColor());
        Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

        valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
        valueText.setFill(gauge.getValueColor());
        Helper.enableNode(valueText, gauge.isValueVisible());

        pane = new Pane(barBorder1,
                        barBorder2,
                        barBackground,
                        ticksAndSectionsCanvas,
                        titleText,
                        unitText,
                        ledCanvas,
                        lcd,
                        valueText,
                        bar,
                        barHighlight);
        pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth()))));
        pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

        getChildren().setAll(pane);
    }
872443
private void setupStyles() {
        TypedArray styledAttributes = obtainStyledAttributes(R.style.PinLock, R.styleable.PinLock);

        final int layoutBackground = styledAttributes.getColor(R.styleable.PinLock_backgroundColor, Color.WHITE);
        View layout = findViewById(R.id.pinLockLayout);
        layout.setBackgroundColor(layoutBackground);

        final int cancelForgotTextSize = styledAttributes.getInt(R.styleable.PinLock_cancelForgotTextSize, 20);
        cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, cancelForgotTextSize);
        forgetButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, cancelForgotTextSize);


        final int cancelForgotTextColor = styledAttributes.getColor(R.styleable.PinLock_cancelForgotTextColor, Color.BLACK);
        cancelButton.setTextColor(cancelForgotTextColor);
        if(forgetButton.isEnabled()) {
            forgetButton.setTextColor(cancelForgotTextColor);
        } else {
            forgetButton.setTextColor(Color.parseColor("#a9abac"));
        }

        final int infoTextSize = styledAttributes.getInt(R.styleable.PinLock_infoTextSize, 20);
        final int infoTextColor = styledAttributes.getColor(R.styleable.PinLock_infoTextColor, Color.BLACK);
        label.setTextSize(TypedValue.COMPLEX_UNIT_SP, infoTextSize);
        label.setTextColor(infoTextColor);
    }
1250460
private void init() {
        if (stops.isEmpty()) return;

        double minFraction = Collections.min(stops.keySet());
        double maxFraction = Collections.max(stops.keySet());

        if (Double.compare(minFraction, 0) > 0) { stops.put(0.0, new Stop(0.0, stops.get(minFraction).getColor())); }
        if (Double.compare(maxFraction, 1) < 0) { stops.put(1.0, new Stop(1.0, stops.get(maxFraction).getColor())); }
    }
296440
private void initGraphics() {
        // Set initial size
        if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
            Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
            if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
                gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
            } else {
                gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
            }
        }

        barBackground = new Region();
        barBackground.setBackground(new Background(new BackgroundFill(gauge.getBarBackgroundColor(), new CornerRadii(0.0, 0.0, 0.025, 0.025, true), Insets.EMPTY)));

        barClip = new Rectangle();

        bar = new Rectangle();
        bar.setFill(gauge.getBarColor());
        bar.setStroke(null);
        bar.setClip(barClip);

        titleText = new Text();
        titleText.setFill(gauge.getTitleColor());
        Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

        valueText = new Text();
        valueText.setFill(gauge.getValueColor());
        Helper.enableNode(valueText, gauge.isValueVisible());

        unitText = new Text(gauge.getUnit());
        unitText.setFill(gauge.getUnitColor());
        Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

        percentageText = new Text();
        percentageText.setFill(gauge.getBarColor());

        percentageUnitText = new Text("%");
        percentageUnitText.setFill(gauge.getBarColor());

        maxValueRect = new Rectangle();
        maxValueRect.setFill(gauge.getThresholdColor());

        maxValueText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMaxValue()));
        maxValueText.setFill(gauge.getBackgroundPaint());

        maxValueUnitText = new Text(gauge.getUnit());
        maxValueUnitText.setFill(gauge.getBackgroundPaint());

        pane = new Pane(barBackground, bar, titleText, valueText, unitText, percentageText, percentageUnitText, maxValueRect, maxValueText, maxValueUnitText);
        pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(gauge.getBorderWidth()))));
        pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY)));

        getChildren().setAll(pane);
    }
894353
def _init_style(self):
        
        self._background = QtGui.QColor('white')
        self._foreground = QtGui.QColor('black')
        self._whitespaces_foreground = QtGui.QColor('light gray')
        app = QtWidgets.QApplication.instance()
        self._sel_background = app.palette().highlight().color()
        self._sel_foreground = app.palette().highlightedText().color()
        self._font_size = 10
        self.font_name = ""
675191
private void initialize() {
        LayoutInflater inflater = LayoutInflater.from(getContext());
        inflater.inflate(R.layout.color_palette_item, this, true);
        colorView = findViewById(R.id.color_view);
        selectionView = findViewById(R.id.selection_view);
        adaptSelectionView();
    }
819705
public static void setColorForInitialsThumb(TextView initialsView, int position) {
        int backgroundColor = THUMB_COLORS[(position) % THUMB_COLORS.length];
        setColorsThumb(initialsView, backgroundColor, Color.WHITE);
    }
264302
function initColor() {
  chalk.enabled = config.color.enable && chalk.enabled;
  chalk.init();
  chalk.setTheme(config.color.theme);
}
992560
private void initGraphics() {
        // Set initial size
        if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
            Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
            if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
                gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
            } else {
                gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
            }
        }

        mainInnerShadow0 = new InnerShadow();
        mainInnerShadow0.setOffsetX(0.0);
        mainInnerShadow0.setOffsetY(0.0);
        mainInnerShadow0.setRadius(0.0625 * PREFERRED_HEIGHT);
        mainInnerShadow0.setColor(Color.rgb(255, 255, 255, 0.5));
        mainInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX);

        mainInnerShadow1 = new InnerShadow();
        mainInnerShadow1.setOffsetX(0.0);
        mainInnerShadow1.setOffsetY(1.0);
        mainInnerShadow1.setRadius(0.04166667 * PREFERRED_HEIGHT);
        mainInnerShadow1.setColor(Color.rgb(0, 0, 0, 0.65));
        mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX);
        mainInnerShadow1.setInput(mainInnerShadow0);

        crystalClip = new Rectangle(0, 0, width, height);
        crystalClip.setArcWidth(5);
        crystalClip.setArcHeight(5);

        crystalImage   = Helper.createNoiseImage(PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8);
        crystalOverlay = new ImageView(crystalImage);
        crystalOverlay.setClip(crystalClip);
        boolean crystalEnabled = gauge.isLcdCrystalEnabled();
        Helper.enableNode(crystalOverlay, crystalEnabled);

        threshold = new Path();
        threshold.setStroke(null);
        Helper.enableNode(threshold, gauge.isThresholdVisible());

        average = new Path();
        average.setStroke(null);
        Helper.enableNode(average, gauge.isAverageVisible());

        backgroundText = new Text(String.format(locale, valueFormatString, gauge.getCurrentValue()));
        backgroundText.setFill(gauge.getLcdDesign().lcdBackgroundColor);
        backgroundText.setOpacity((LcdFont.LCD == gauge.getLcdFont() || LcdFont.ELEKTRA == gauge.getLcdFont()) ? 1 : 0);

        valueText = new Text(String.format(locale, valueFormatString, gauge.getCurrentValue()));
        valueText.setFill(gauge.getLcdDesign().lcdForegroundColor);

        unitText = new Text(gauge.getUnit());
        unitText.setFill(gauge.getLcdDesign().lcdForegroundColor);
        Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

        title = new Text(gauge.getTitle());
        title.setFill(gauge.getLcdDesign().lcdForegroundColor);
        Helper.enableNode(title, !gauge.getTitle().isEmpty());

        lowerRightText = new Text(gauge.getSubTitle());
        lowerRightText.setFill(gauge.getLcdDesign().lcdForegroundColor);
        Helper.enableNode(lowerRightText, !gauge.getSubTitle().isEmpty());

        upperLeftText = new Text(String.format(locale, otherFormatString, gauge.getMinMeasuredValue()));
        upperLeftText.setFill(gauge.getLcdDesign().lcdForegroundColor);
        Helper.enableNode(upperLeftText, gauge.isMinMeasuredValueVisible());

        upperRightText = new Text(String.format(locale, otherFormatString, gauge.getMaxMeasuredValue()));
        upperRightText.setFill(gauge.getLcdDesign().lcdForegroundColor);
        Helper.enableNode(upperRightText, gauge.isMaxMeasuredValueVisible());

        lowerCenterText = new Text(String.format(locale, otherFormatString, gauge.getOldValue()));
        lowerCenterText.setFill(gauge.getLcdDesign().lcdForegroundColor);
        Helper.enableNode(lowerCenterText, gauge.isOldValueVisible());

        shadowGroup = new Group();
        shadowGroup.setEffect(gauge.isShadowsEnabled() ? FOREGROUND_SHADOW : null);
        shadowGroup.getChildren().setAll(threshold,
                                         average,
                                         valueText,
                                         unitText,
                                         title,
                                         lowerRightText,
                                         upperLeftText,
                                         upperRightText,
                                         lowerCenterText);

        pane = new Pane(crystalOverlay, backgroundText, shadowGroup);
        pane.setEffect(gauge.isShadowsEnabled() ? mainInnerShadow1 : null);
        getChildren().setAll(pane);
    }
545443
protected function _init()
    {
        // get the Web Colors from TCPDF
        require(K_PATH_MAIN.'htmlcolors.php');
        $this->_htmlColor = $webcolor;

        // init the Style
        $this->table = array();
        $this->value = array();
        $this->initStyle();

        // Init the styles without legacy
        $this->resetStyle();
    }
1362168
def init(cls):
        
        for el in cls.switcher_els:
            el.checked = False

        cls.bind_switcher()

        cls._draw_conspects()
        cls._create_searchable_typeahead()
1170786
def _run(self, stdscr):
        """"""
        with self._lock:
            curses.use_default_colors()
            curses.curs_set(False)
            curses.init_pair(1, curses.COLOR_RED, -1)
            curses.init_pair(2, curses.COLOR_BLACK, -1)
            curses.init_pair(3, curses.COLOR_GREEN, -1)
            self._redraw_screen(stdscr)

        try:
            while not self.shutdown:
                now = int(time.time())
                with self._lock:
                    overview = self._node_status.copy()
                cardnumber = 0
                for host, status in overview.items():
                    age = now - int(status["last_seen"] / 1000)
                    with self._lock:
                        if age > 90:
                            del self._node_status[host]
                        else:
                            card = self._get_card(cardnumber)
                            card.erase()
                            card.move(0, 0)
                            card.addstr("Host: ", curses.color_pair(3))
                            card.addstr(host)
                            card.move(1, 0)
                            card.addstr("Service: ", curses.color_pair(3))
                            if "service" in status and status["service"]:
                                card.addstr(status["service"])
                            else:
                                card.addstr("---", curses.color_pair(2))
                            card.move(2, 0)
                            card.addstr("State: ", curses.color_pair(3))
                            if "status" in status:
                                status_code = status["status"]
                                state_string = CommonService.human_readable_state.get(
                                    status_code, str(status_code)
                                )
                                state_color = None
                                if status_code in (
                                    CommonService.SERVICE_STATUS_PROCESSING,
                                    CommonService.SERVICE_STATUS_TIMER,
                                ):
                                    state_color = curses.color_pair(3) + curses.A_BOLD
                                if status_code == CommonService.SERVICE_STATUS_IDLE:
                                    state_color = curses.color_pair(2) + curses.A_BOLD
                                if status_code == CommonService.SERVICE_STATUS_ERROR:
                                    state_color = curses.color_pair(1)
                                if state_color:
                                    card.addstr(state_string, state_color)
                                else:
                                    card.addstr(state_string)
                            card.move(3, 0)
                            if age >= 10:
                                card.addstr(
                                    "last seen %d seconds ago" % age,
                                    curses.color_pair(1)
                                    + (0 if age < 60 else curses.A_BOLD),
                                )
                            card.noutrefresh()
                            cardnumber = cardnumber + 1
                if cardnumber < len(self.cards):
                    with self._lock:
                        self._erase_card(cardnumber)
                with self._lock:
                    curses.doupdate()
                time.sleep(0.2)
        except KeyboardInterrupt:
            pass  # User pressed CTRL+C
        self._transport.disconnect()