MCPcopy Create free account
hub / github.com/KDE/kdevelop / reset

Method reset

kdevplatform/language/highlighting/configurablecolors.cpp:33–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void ConfigurableHighlightingColors::reset(ColorCache* cache, KTextEditor::View* view)
34{
35 m_attributes.clear();
36 auto createAttribute = [&](CodeHighlightingType type) {
37 KTextEditor::Attribute::Ptr a(new KTextEditor::Attribute);
38 m_attributes[type] = a;
39 return a;
40 };
41 auto addColor = [&](CodeHighlightingType type, QRgb color_) {
42 auto a = createAttribute(type);
43 auto color = QColor::fromRgb(color_);
44 a->setForeground(cache ? cache->blendGlobalColor(color) : color);
45 ifDebug(qCDebug(LANGUAGE) << #type << "color: " << #color_ << "->" << a->foreground().color().name());
46 };
47 // TODO: The set of colors doesn't work very well. Many colors simply too dark (even on the maximum "Global colorization intensity" they hardly distinguishable from grey) and look alike.
48 addColor(CodeHighlightingType::Class, 0x005912); // Dark green
49 addColor(CodeHighlightingType::TypeAlias, 0x35938d);
50 addColor(CodeHighlightingType::Enum, 0x6c101e); // Dark red
51 addColor(CodeHighlightingType::Enumerator, 0x862a38); // Greyish red
52 addColor(CodeHighlightingType::Function, 0x21005A); // Navy blue
53 addColor(CodeHighlightingType::MemberVariable, 0x443069); // Dark Burple (blue/purple)
54 addColor(CodeHighlightingType::LocalClassMember, 0xae7d00); // Light orange
55 addColor(CodeHighlightingType::LocalMemberFunction, 0xae7d00);
56 addColor(CodeHighlightingType::InheritedClassMember, 0x705000); // Dark orange
57 addColor(CodeHighlightingType::InheritedMemberFunction, 0x705000);
58 addColor(CodeHighlightingType::LocalVariable, 0x0C4D3C);
59 addColor(CodeHighlightingType::FunctionVariable, 0x300085); // Less dark navy blue
60 addColor(CodeHighlightingType::NamespaceVariable, 0x9F3C5F); // Rose
61 addColor(CodeHighlightingType::GlobalVariable, 0x12762B); // Grass green
62 addColor(CodeHighlightingType::Namespace, 0x6B2840); // Dark rose
63 addColor(CodeHighlightingType::ForwardDeclaration, 0x5C5C5C); // Gray
64 addColor(CodeHighlightingType::Macro, 0xA41239);
65 addColor(CodeHighlightingType::MacroFunctionLike, 0x008080);
66
67 {
68 auto highlightUses = createAttribute(CodeHighlightingType::HighlightUses);
69 highlightUses->setDefaultStyle(KSyntaxHighlighting::Theme::TextStyle::Normal);
70 highlightUses->setForeground(highlightUses->selectedForeground());
71 highlightUses->setBackground(highlightUses->selectedBackground());
72 highlightUses->setBackgroundFillWhitespace(true);
73 if (view) {
74 const auto searchHighlight = view->theme().editorColor(KSyntaxHighlighting::Theme::SearchHighlight);
75 highlightUses->setBackground(QColor::fromRgb(searchHighlight));
76 }
77 }
78 {
79 auto error = createAttribute(CodeHighlightingType::Error);
80 error->setDefaultStyle(KSyntaxHighlighting::Theme::TextStyle::Error);
81 }
82}
83}

Callers 6

DeclarationContextMethod · 0.45
updateColorsFromViewMethod · 0.45
pixmapMethod · 0.45
clearMethod · 0.45

Calls 2

blendGlobalColorMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected