void Theme::fillDefault() { addToTheme(mFormats, "text", QColor(Qt::black), QColor(Qt::white)); QPalette appPlt(QApplication::palette()); QColor bkg = appPlt.color(QPalette::Base); int value = bkg.value(); if (value > 40) bkg.setHsv(bkg.hue(), bkg.saturation(), value - 11); else bkg.setHsv(bkg.hue(), bkg.saturation(), value + 20); addToTheme(mFormats, "currentLine", QColor(Qt::black), bkg.toRgb()); addToTheme(mFormats, "searchResult", appPlt.color(QPalette::HighlightedText).darker(200), appPlt.color(QPalette::Highlight).darker(200)); addToTheme(mFormats, "matchingBrackets", QColor("#2bc93d"), Qt::yellow, true); addToTheme(mFormats, "mismatchedBrackets", Qt::white, QColor(150,0,0)); addToTheme(mFormats, "evaluatedCode", Qt::black, QColor("#F8A200")); QPalette plt(QApplication::palette()); QColor base = plt.color(QPalette::Base); QColor text = plt.color(QPalette::Text); int shade = (base.red() + base.green() + base.blue() < 380) ? 160 : 100; QColor whitespace_color((base.red() + text.red()) / 2, (base.green() + text.green()) / 2, (base.blue() + text.blue()) / 2); addToTheme(mFormats, "whitespace", whitespace_color); addToTheme(mFormats, "keyword", QColor(0,0,230).lighter(shade), QColor(Qt::transparent), true); addToTheme(mFormats, "built-in", QColor(51,51,191).lighter(shade)); addToTheme(mFormats, "env-var", QColor(140,70,20).lighter(shade)); addToTheme(mFormats, "class", QColor(0,0,210).lighter(shade)); addToTheme(mFormats, "number", QColor(152,0,153).lighter(shade)); addToTheme(mFormats, "symbol", QColor(0,115,0).lighter(shade)); addToTheme(mFormats, "string", QColor(95,95,95).lighter(shade)); addToTheme(mFormats, "char", QColor(0,115,0).lighter(shade)); addToTheme(mFormats, "comment", QColor(191,0,0).lighter(shade)); addToTheme(mFormats, "primitive", QColor(51,51,191).lighter(shade)); addToTheme(mFormats, "lineNumbers", plt.color(QPalette::ButtonText), plt.color(QPalette::Mid)); addToTheme(mFormats, "selection", plt.color(QPalette::HighlightedText), plt.color(QPalette::Highlight)); addToTheme(mFormats, "postwindowtext", plt.color(QPalette::ButtonText)); addToTheme(mFormats, "postwindowerror", QColor(209, 28, 36)); addToTheme(mFormats, "postwindowwarning", QColor(165, 119, 6)); addToTheme(mFormats, "postwindowsuccess", QColor(115, 138, 5)); addToTheme(mFormats, "postwindowemphasis", Qt::black, Qt::transparent, true); }
void Manager::initHighlightingDefaults() { QPalette plt( QApplication::palette() ); QColor base = plt.color(QPalette::Base); QColor text = plt.color(QPalette::Text); int shade = (base.red() + base.green() + base.blue() < 380) ? 160 : 100; QColor whitespace_color( (base.red() + text.red()) / 2, (base.green() + text.green()) / 2, (base.blue() + text.blue()) / 2 ); setDefault( "whitespace", makeHlFormat( whitespace_color ) ); setDefault( "keyword", makeHlFormat( QColor(0,0,230).lighter(shade), QFont::Bold ) ); setDefault( "built-in", makeHlFormat( QColor(51,51,191).lighter(shade) ) ); setDefault( "env-var", makeHlFormat( QColor(140,70,20).lighter(shade) ) ); setDefault( "class", makeHlFormat( QColor(0,0,210).lighter(shade) ) ); setDefault( "number", makeHlFormat( QColor(152,0,153).lighter(shade) ) ); setDefault( "symbol", makeHlFormat( QColor(0,115,0).lighter(shade) ) ); setDefault( "string", makeHlFormat( QColor(95,95,95).lighter(shade) ) ); setDefault( "char", makeHlFormat( QColor(0,115,0).lighter(shade) ) ); setDefault( "comment", makeHlFormat( QColor(191,0,0).lighter(shade) ) ); setDefault( "primitive", makeHlFormat( QColor(51,51,191).lighter(shade) ) ); }