Changeset View
Changeset View
Standalone View
Standalone View
src/kcolorscheme.cpp
Show First 20 Lines • Show All 248 Lines • ▼ Show 20 Line(s) | 244 | static const SetDefaultColors defaultComplementaryColors = { | |||
---|---|---|---|---|---|
249 | { 147, 206, 233 }, // Active | 249 | { 147, 206, 233 }, // Active | ||
250 | { 61, 174, 230 }, // Link | 250 | { 61, 174, 230 }, // Link | ||
251 | { 61, 174, 230 }, // Visited | 251 | { 61, 174, 230 }, // Visited | ||
252 | { 231, 76, 60 }, // Negative | 252 | { 231, 76, 60 }, // Negative | ||
253 | { 253, 188, 75 }, // Neutral | 253 | { 253, 188, 75 }, // Neutral | ||
254 | { 46, 174, 230 } // Positive | 254 | { 46, 174, 230 } // Positive | ||
255 | }; | 255 | }; | ||
256 | 256 | | |||
257 | static const SetDefaultColors defaultHeaderColors = { | ||||
258 | { 49, 54, 59 }, // Background | ||||
ndavis: ` 227, 229, 231 ` | |||||
259 | { 59, 64, 69 }, // Alternate | ||||
ndavis: ` 239, 240, 241 ` | |||||
260 | { 239, 240, 241 }, // Normal | ||||
ndavis: ` 35, 38, 41 ` | |||||
261 | { 175, 176, 179 }, // Inactive | ||||
ndavis: ` 112, 125, 138 ` | |||||
262 | { 147, 206, 233 }, // Active | ||||
ndavis: ` 61, 174, 233 ` | |||||
263 | { 61, 174, 230 }, // Link | ||||
ndavis: ` 41, 128, 185 ` | |||||
264 | { 61, 174, 230 }, // Visited | ||||
ndavis: ` 155, 89, 182 ` | |||||
265 | { 231, 76, 60 }, // Negative | ||||
ndavis: ` 218, 68, 83 ` | |||||
266 | { 253, 188, 75 }, // Neutral | ||||
ndavis: ` 246, 116, 0 ` | |||||
267 | { 46, 174, 230 } // Positive | ||||
ndavis: ` 39, 174, 96 ` | |||||
268 | }; | ||||
269 | | ||||
257 | static const DecoDefaultColors defaultDecorationColors = { | 270 | static const DecoDefaultColors defaultDecorationColors = { | ||
258 | { 61, 174, 233 }, // Focus | 271 | { 61, 174, 233 }, // Focus | ||
I would have expected at least of one the new colors to have the same value as this one. davidre: I would have expected at least of one the new colors to have the same value as this one. | |||||
Why is that? The only one that might is Active, but that's not really used much right now. ndavis: Why is that? The only one that might is Active, but that's not really used much right now. | |||||
Because the new colors are the replacement for theses colors. I thought one of those might map to this davidre: Because the new colors are the replacement for theses colors. I thought one of those might map… | |||||
i also added a question on the task, whether final colors are decided for it, they should go up here mart: i also added a question on the task, whether final colors are decided for it, they should go up… | |||||
259 | { 147, 206, 233 }, // Hover | 272 | { 147, 206, 233 }, // Hover | ||
260 | }; | 273 | }; | ||
261 | //END default colors | 274 | //END default colors | ||
262 | 275 | | |||
263 | KSharedConfigPtr defaultConfig() { | 276 | KSharedConfigPtr defaultConfig() { | ||
264 | // cache the value we'll return, since usually it's going to be the same value | 277 | // cache the value we'll return, since usually it's going to be the same value | ||
265 | static thread_local KSharedConfigPtr config; | 278 | static thread_local KSharedConfigPtr config; | ||
266 | // Read from the application's color scheme file (as set by KColorSchemeManager). | 279 | // Read from the application's color scheme file (as set by KColorSchemeManager). | ||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | |||||
339 | } | 352 | } | ||
340 | 353 | | |||
341 | void KColorSchemePrivate::init(const KSharedConfigPtr &config, | 354 | void KColorSchemePrivate::init(const KSharedConfigPtr &config, | ||
342 | QPalette::ColorGroup state, | 355 | QPalette::ColorGroup state, | ||
343 | const char *group, | 356 | const char *group, | ||
344 | const SetDefaultColors &defaults) | 357 | const SetDefaultColors &defaults) | ||
345 | { | 358 | { | ||
346 | KConfigGroup cfg(config, group); | 359 | KConfigGroup cfg(config, group); | ||
360 | bool hasInactivePalette = false; | ||||
361 | if (state == QPalette::Inactive) { | ||||
362 | KConfigGroup inactiveGroup = KConfigGroup(&cfg, "Inactive"); | ||||
363 | if (inactiveGroup.exists()) { | ||||
364 | cfg = inactiveGroup; | ||||
365 | hasInactivePalette = true; | ||||
366 | } | ||||
367 | } | ||||
347 | 368 | | |||
348 | // loaded-from-config colors | 369 | // loaded-from-config colors | ||
349 | _brushes.fg[KColorScheme::NormalText] = cfg.readEntry("ForegroundNormal", SET_DEFAULT(NormalText)); | 370 | _brushes.fg[KColorScheme::NormalText] = cfg.readEntry("ForegroundNormal", SET_DEFAULT(NormalText)); | ||
350 | _brushes.fg[KColorScheme::InactiveText] = cfg.readEntry("ForegroundInactive", SET_DEFAULT(InactiveText)); | 371 | _brushes.fg[KColorScheme::InactiveText] = cfg.readEntry("ForegroundInactive", SET_DEFAULT(InactiveText)); | ||
351 | _brushes.fg[KColorScheme::ActiveText] = cfg.readEntry("ForegroundActive", SET_DEFAULT(ActiveText)); | 372 | _brushes.fg[KColorScheme::ActiveText] = cfg.readEntry("ForegroundActive", SET_DEFAULT(ActiveText)); | ||
352 | _brushes.fg[KColorScheme::LinkText] = cfg.readEntry("ForegroundLink", SET_DEFAULT(LinkText)); | 373 | _brushes.fg[KColorScheme::LinkText] = cfg.readEntry("ForegroundLink", SET_DEFAULT(LinkText)); | ||
353 | _brushes.fg[KColorScheme::VisitedText] = cfg.readEntry("ForegroundVisited", SET_DEFAULT(VisitedText)); | 374 | _brushes.fg[KColorScheme::VisitedText] = cfg.readEntry("ForegroundVisited", SET_DEFAULT(VisitedText)); | ||
354 | _brushes.fg[KColorScheme::NegativeText] = cfg.readEntry("ForegroundNegative", SET_DEFAULT(NegativeText)); | 375 | _brushes.fg[KColorScheme::NegativeText] = cfg.readEntry("ForegroundNegative", SET_DEFAULT(NegativeText)); | ||
355 | _brushes.fg[KColorScheme::NeutralText] = cfg.readEntry("ForegroundNeutral", SET_DEFAULT(NeutralText)); | 376 | _brushes.fg[KColorScheme::NeutralText] = cfg.readEntry("ForegroundNeutral", SET_DEFAULT(NeutralText)); | ||
356 | _brushes.fg[KColorScheme::PositiveText] = cfg.readEntry("ForegroundPositive", SET_DEFAULT(PositiveText)); | 377 | _brushes.fg[KColorScheme::PositiveText] = cfg.readEntry("ForegroundPositive", SET_DEFAULT(PositiveText)); | ||
357 | 378 | | |||
358 | _brushes.deco[KColorScheme::FocusColor] = cfg.readEntry("DecorationFocus", DECO_DEFAULT(Focus)); | 379 | _brushes.deco[KColorScheme::FocusColor] = cfg.readEntry("DecorationFocus", DECO_DEFAULT(Focus)); | ||
359 | _brushes.deco[KColorScheme::HoverColor] = cfg.readEntry("DecorationHover", DECO_DEFAULT(Hover)); | 380 | _brushes.deco[KColorScheme::HoverColor] = cfg.readEntry("DecorationHover", DECO_DEFAULT(Hover)); | ||
360 | 381 | | |||
361 | // apply state adjustments | 382 | // apply state adjustments | ||
362 | if (state != QPalette::Active) { | 383 | if (state != QPalette::Active || (state == QPalette::Inactive && !hasInactivePalette)) { | ||
363 | StateEffects effects(state, config); | 384 | StateEffects effects(state, config); | ||
364 | for (auto &fg : _brushes.fg) { | 385 | for (auto &fg : _brushes.fg) { | ||
365 | fg = effects.brush(fg, _brushes.bg[KColorScheme::NormalBackground]); | 386 | fg = effects.brush(fg, _brushes.bg[KColorScheme::NormalBackground]); | ||
366 | } | 387 | } | ||
367 | for (auto &deco : _brushes.deco) { | 388 | for (auto &deco : _brushes.deco) { | ||
368 | deco = effects.brush(deco, _brushes.bg[KColorScheme::NormalBackground]); | 389 | deco = effects.brush(deco, _brushes.bg[KColorScheme::NormalBackground]); | ||
369 | } | 390 | } | ||
370 | _brushes.bg[KColorScheme::NormalBackground] = effects.brush(_brushes.bg[KColorScheme::NormalBackground]); | 391 | _brushes.bg[KColorScheme::NormalBackground] = effects.brush(_brushes.bg[KColorScheme::NormalBackground]); | ||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 477 | case Selection: { | |||
469 | } | 490 | } | ||
470 | } break; | 491 | } break; | ||
471 | case Tooltip: | 492 | case Tooltip: | ||
472 | d = new KColorSchemePrivate(config, state, "Colors:Tooltip", defaultTooltipColors); | 493 | d = new KColorSchemePrivate(config, state, "Colors:Tooltip", defaultTooltipColors); | ||
473 | break; | 494 | break; | ||
474 | case Complementary: | 495 | case Complementary: | ||
475 | d = new KColorSchemePrivate(config, state, "Colors:Complementary", defaultComplementaryColors); | 496 | d = new KColorSchemePrivate(config, state, "Colors:Complementary", defaultComplementaryColors); | ||
476 | break; | 497 | break; | ||
498 | case Header: | ||||
499 | d = new KColorSchemePrivate(config, state, "Colors:Header", defaultHeaderColors); | ||||
500 | break; | ||||
477 | default: | 501 | default: | ||
478 | d = new KColorSchemePrivate(config, state, "Colors:View", defaultViewColors); | 502 | d = new KColorSchemePrivate(config, state, "Colors:View", defaultViewColors); | ||
479 | } | 503 | } | ||
480 | } | 504 | } | ||
481 | 505 | | |||
482 | // static | 506 | // static | ||
483 | int KColorScheme::contrast() | 507 | int KColorScheme::contrast() | ||
484 | { | 508 | { | ||
▲ Show 20 Lines • Show All 257 Lines • Show Last 20 Lines |
227, 229, 231