Debian Codegraph @

lib/ColorScheme.cpp

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 /*
2 This source file is part of Konsole, a terminal emulator.
3
4 Copyright 2007-2008 by Robert Knight <[email protected]>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20 */
21
22 // Own
23 #include "ColorScheme.h"
24 #include "tools.h"
25
26 // Qt
27 #include <QBrush>
28 #include <QFile>
29 #include <QFileInfo>
30 #include <QtDebug>
31 #include <QSettings>
32 #include <QDir>
33 #include <QRegularExpression>
34
35
36 // KDE
37 //#include <KColorScheme>
38 //#include <KConfig>
39 //#include <KLocale>
40 //#include <KDebug>
41 //#include <KConfigGroup>
42 //#include <KStandardDirs>
43
44 using namespace Konsole;
45
46 const ColorEntry ColorScheme::defaultTable[TABLE_COLORS] =
47 // The following are almost IBM standard color codes, with some slight
48 // gamma correction for the dim colors to compensate for bright X screens.
49 // It contains the 8 ansiterm/xterm colors in 2 intensities.
50 {
51 ColorEntry( QColor(0x00,0x00,0x00), false), ColorEntry(
52 QColor(0xFF,0xFF,0xFF), true), // Dfore, Dback
53 ColorEntry( QColor(0x00,0x00,0x00), false), ColorEntry(
54 QColor(0xB2,0x18,0x18), false), // Black, Red
55 ColorEntry( QColor(0x18,0xB2,0x18), false), ColorEntry(
56 QColor(0xB2,0x68,0x18), false), // Green, Yellow
57 ColorEntry( QColor(0x18,0x18,0xB2), false), ColorEntry(
58 QColor(0xB2,0x18,0xB2), false), // Blue, Magenta
59 ColorEntry( QColor(0x18,0xB2,0xB2), false), ColorEntry(
60 QColor(0xB2,0xB2,0xB2), false), // Cyan, White
61 // intensive
62 ColorEntry( QColor(0x00,0x00,0x00), false), ColorEntry(
63 QColor(0xFF,0xFF,0xFF), true),
64 ColorEntry( QColor(0x68,0x68,0x68), false), ColorEntry(
65 QColor(0xFF,0x54,0x54), false),
66 ColorEntry( QColor(0x54,0xFF,0x54), false), ColorEntry(
67 QColor(0xFF,0xFF,0x54), false),
68 ColorEntry( QColor(0x54,0x54,0xFF), false), ColorEntry(
69 QColor(0xFF,0x54,0xFF), false),
70 ColorEntry( QColor(0x54,0xFF,0xFF), false), ColorEntry(
71 QColor(0xFF,0xFF,0xFF), false)
72 };
73
74 const char* const ColorScheme::colorNames[TABLE_COLORS] =
75 {
76 "Foreground",
77 "Background",
78 "Color0",
79 "Color1",
80 "Color2",
81 "Color3",
82 "Color4",
83 "Color5",
84 "Color6",
85 "Color7",
86 "ForegroundIntense",
87 "BackgroundIntense",
88 "Color0Intense",
89 "Color1Intense",
90 "Color2Intense",
91 "Color3Intense",
92 "Color4Intense",
93 "Color5Intense",
94 "Color6Intense",
95 "Color7Intense"
96 };
97 // dummy silently comment out the tr_NOOP
98 #define tr_NOOP
99 const char* const ColorScheme::translatedColorNames[TABLE_COLORS] =
100 {
101 tr_NOOP("Foreground"),
102 tr_NOOP("Background"),
103 tr_NOOP("Color 1"),
104 tr_NOOP("Color 2"),
105 tr_NOOP("Color 3"),
106 tr_NOOP("Color 4"),
107 tr_NOOP("Color 5"),
108 tr_NOOP("Color 6"),
109 tr_NOOP("Color 7"),
110 tr_NOOP("Color 8"),
111 tr_NOOP("Foreground (Intense)"),
112 tr_NOOP("Background (Intense)"),
113 tr_NOOP("Color 1 (Intense)"),
114 tr_NOOP("Color 2 (Intense)"),
115 tr_NOOP("Color 3 (Intense)"),
116 tr_NOOP("Color 4 (Intense)"),
117 tr_NOOP("Color 5 (Intense)"),
118 tr_NOOP("Color 6 (Intense)"),
119 tr_NOOP("Color 7 (Intense)"),
120 tr_NOOP("Color 8 (Intense)")
121 };
122
•123 ColorScheme::ColorScheme(QObject *parent) : QObject(parent)
124 {
125 _table = nullptr;
126 _randomTable = nullptr;
127 _opacity = 1.0;
128 }
129 ColorScheme::~ColorScheme()
130 {
131 delete[] _table;
132 delete[] _randomTable;
133 }
134
135 void ColorScheme::setDescription(const QString& description) { _description = description; }
136 QString ColorScheme::description() const { return _description; }
137
138 void ColorScheme::setName(const QString& name) { _name = name; }
139 QString ColorScheme::name() const { return _name; }
140
141 void ColorScheme::setColorTableEntry(int index , const ColorEntry& entry)
142 {
143 Q_ASSERT( index >= 0 && index < TABLE_COLORS );
144
145 if ( !_table )
146 {
147 _table = new ColorEntry[TABLE_COLORS];
148
149 for (int i=0;i<TABLE_COLORS;i++)
150 _table[i] = defaultTable[i];
151 }
152
153 _table[index] = entry;
154 }
155 ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const
156 {
157 Q_ASSERT( index >= 0 && index < TABLE_COLORS );
158
159 if ( randomSeed != 0 )
160 qsrand(randomSeed);
161
162 ColorEntry entry = colorTable()[index];
163
164 if ( randomSeed != 0 &&
165 _randomTable != nullptr &&
166 !_randomTable[index].isNull() )
167 {
168 const RandomizationRange& range = _randomTable[index];
169
170
171 int hueDifference = range.hue ? (qrand() % range.hue) - range.hue/2 : 0;
172 int saturationDifference = range.saturation ? (qrand() % range.saturation) - range.saturation/2 : 0;
173 int valueDifference = range.value ? (qrand() % range.value) - range.value/2 : 0;
174
175 QColor& color = entry.color;
176
177 int newHue = qAbs( (color.hue() + hueDifference) % MAX_HUE );
178 int newValue = qMin( qAbs(color.value() + valueDifference) , 255 );
179 int newSaturation = qMin( qAbs(color.saturation() + saturationDifference) , 255 );
180
181 color.setHsv(newHue,newSaturation,newValue);
182 }
183
184 return entry;
185 }
•186 QColor ColorScheme::getColor(int index) const
187 {
188 return colorEntry(index).color;
189 }
190 void ColorScheme::setColor(int index, QColor color)
191 {
192 ColorEntry colorEntry = ColorScheme::colorEntry(index);
193 if (colorEntry.color != color) {
194 colorEntry.color = color;
195 setColorTableEntry(index, colorEntry);
196 Q_EMIT colorChanged(index);
197 }
198 }
199 void ColorScheme::getColorTable(ColorEntry* table , uint randomSeed) const
200 {
201 for ( int i = 0 ; i < TABLE_COLORS ; i++ )
202 table[i] = colorEntry(i,randomSeed);
203 }
204 bool ColorScheme::randomizedBackgroundColor() const
205 {
206 return _randomTable == nullptr ? false : !_randomTable[1].isNull();
207 }
208 void ColorScheme::setRandomizedBackgroundColor(bool randomize)
209 {
210 // the hue of the background colour is allowed to be randomly
211 // adjusted as much as possible.
212 //
213 // the value and saturation are left alone to maintain read-ability
214 if ( randomize )
215 {
216 setRandomizationRange( 1 /* background color index */ , MAX_HUE , 255 , 0 );
217 }
218 else
219 {
220 if ( _randomTable )
221 setRandomizationRange( 1 /* background color index */ , 0 , 0 , 0 );
222 }
223 }
224
225 void ColorScheme::setRandomizationRange( int index , quint16 hue , quint8 saturation ,
226 quint8 value )
227 {
228 Q_ASSERT( hue <= MAX_HUE );
229 Q_ASSERT( index >= 0 && index < TABLE_COLORS );
230
231 if ( _randomTable == nullptr )
232 _randomTable = new RandomizationRange[TABLE_COLORS];
233
234 _randomTable[index].hue = hue;
235 _randomTable[index].value = value;
236 _randomTable[index].saturation = saturation;
237 }
238
239 const ColorEntry* ColorScheme::colorTable() const
240 {
241 if ( _table )
242 return _table;
243 else
244 return defaultTable;
245 }
246 QColor ColorScheme::foregroundColor() const
247 {
248 return colorTable()[0].color;
249 }
250 QColor ColorScheme::backgroundColor() const
251 {
252 return colorTable()[1].color;
253 }
254 bool ColorScheme::hasDarkBackground() const
255 {
256 // value can range from 0 - 255, with larger values indicating higher brightness.
257 // so 127 is in the middle, anything less is deemed 'dark'
258 return backgroundColor().value() < 127;
259 }
•260 void ColorScheme::setOpacity(qreal opacity) { _opacity = opacity; opacityChanged(); }
261 qreal ColorScheme::opacity() const { return _opacity; }
262
263 void ColorScheme::read(const QString & fileName)
264 {
265 QSettings s(fileName, QSettings::IniFormat);
266 s.beginGroup(QLatin1String("General"));
267
268 _description = s.value(QLatin1String("Description"), QObject::tr("Un-named Color Scheme")).toString();
269 _opacity = s.value(QLatin1String("Opacity"),qreal(1.0)).toDouble();
270 s.endGroup();
271
272 for (int i=0 ; i < TABLE_COLORS ; i++)
273 {
274 readColorEntry(&s, i);
275 }
276 }
•277
278 void ColorScheme::write(const QString & fileName) const
279 {
280 QSettings s(fileName, QSettings::IniFormat);
281 s.beginGroup("General");
282
283 s.setValue("Description", _description);
284 s.setValue("Opacity", _opacity);
285 s.endGroup();
286
287 for (int i=0 ; i < TABLE_COLORS ; i++)
288 {
289 writeColorEntry(&s, i, colorTable()[i]);
290 }
291 }
292 #if 0
293 // implemented upstream - user apps
294 void ColorScheme::read(KConfig& config)
295 {
296 KConfigGroup configGroup = config.group("General");
297
298 QString description = configGroup.readEntry("Description", QObject::tr("Un-named Color Scheme"));
299
300 _description = tr(description.toUtf8());
301 _opacity = configGroup.readEntry("Opacity",qreal(1.0));
302
303 for (int i=0 ; i < TABLE_COLORS ; i++)
304 {
305 readColorEntry(config,i);
306 }
307 }
308 void ColorScheme::write(KConfig& config) const
309 {
310 KConfigGroup configGroup = config.group("General");
311
312 configGroup.writeEntry("Description",_description);
313 configGroup.writeEntry("Opacity",_opacity);
314
315 for (int i=0 ; i < TABLE_COLORS ; i++)
316 {
317 RandomizationRange random = _randomTable != 0 ? _randomTable[i] : RandomizationRange();
318 writeColorEntry(config,colorNameForIndex(i),colorTable()[i],random);
319 }
320 }
321 #endif
322
323 QString ColorScheme::colorNameForIndex(int index)
324 {
325 Q_ASSERT( index >= 0 && index < TABLE_COLORS );
326
327 return QString::fromLatin1(colorNames[index]);
328 }
329 QString ColorScheme::translatedColorNameForIndex(int index)
330 {
331 Q_ASSERT( index >= 0 && index < TABLE_COLORS );
332
333 return QString::fromLatin1(translatedColorNames[index]);
334 }
335
336 void ColorScheme::readColorEntry(QSettings * s , int index)
337 {
338 QString colorName = colorNameForIndex(index);
339
340 s->beginGroup(colorName);
341
342 ColorEntry entry;
343
344 QVariant colorValue = s->value(QLatin1String("Color"));
345 QString colorStr;
346 int r, g, b;
347 bool ok = false;
348 // XXX: Undocumented(?) QSettings behavior: values with commas are parsed
349 // as QStringList and others QString
350 if (colorValue.type() == QVariant::StringList)
351 {
352 QStringList rgbList = colorValue.toStringList();
353 colorStr = rgbList.join(QLatin1Char(','));
354 if (rgbList.count() == 3)
355 {
356 bool parse_ok;
357
358 ok = true;
359 r = rgbList[0].toInt(&parse_ok);
360 ok = ok && parse_ok && (r >= 0 && r <= 0xff);
361 g = rgbList[1].toInt(&parse_ok);
362 ok = ok && parse_ok && (g >= 0 && g <= 0xff);
363 b = rgbList[2].toInt(&parse_ok);
364 ok = ok && parse_ok && (b >= 0 && b <= 0xff);
365 }
366 }
367 else
368 {
369 colorStr = colorValue.toString();
370 QRegularExpression hexColorPattern(QLatin1String("^#[0-9a-f]{6}$"),
371 QRegularExpression::CaseInsensitiveOption);
372 if (hexColorPattern.match(colorStr).hasMatch())
373 {
374 // Parsing is always ok as already matched by the regexp
375 r = colorStr.midRef(1, 2).toInt(nullptr, 16);
376 g = colorStr.midRef(3, 2).toInt(nullptr, 16);
377 b = colorStr.midRef(5, 2).toInt(nullptr, 16);
378 ok = true;
379 }
380 }
381 if (!ok)
382 {
383 qWarning().nospace() << "Invalid color value " << colorStr
384 << " for " << colorName << ". Fallback to black.";
385 r = g = b = 0;
386 }
387 entry.color = QColor(r, g, b);
388
389 entry.transparent = s->value(QLatin1String("Transparent"),false).toBool();
390
391 // Deprecated key from KDE 4.0 which set 'Bold' to true to force
392 // a color to be bold or false to use the current format
393 //
394 // TODO - Add a new tri-state key which allows for bold, normal or
395 // current format
396 if (s->contains(QLatin1String("Bold")))
397 entry.fontWeight = s->value(QLatin1String("Bold"),false).toBool() ? ColorEntry::Bold :
398 ColorEntry::UseCurrentFormat;
399
400 quint16 hue = s->value(QLatin1String("MaxRandomHue"),0).toInt();
401 quint8 value = s->value(QLatin1String("MaxRandomValue"),0).toInt();
402 quint8 saturation = s->value(QLatin1String("MaxRandomSaturation"),0).toInt();
403
404 setColorTableEntry( index , entry );
405
406 if ( hue != 0 || value != 0 || saturation != 0 )
407 setRandomizationRange( index , hue , saturation , value );
408
409 s->endGroup();
410 }
•411 void ColorScheme::writeColorEntry(QSettings * s, int index, const ColorEntry& entry) const
412 {
413 s->beginGroup(colorNameForIndex(index));
414 QStringList colorList;
415 colorList << QString::number(entry.color.red()) << QString::number(entry.color.green()) << QString::number(entry.color.blue());
416 s->setValue("Color", colorList);
417 s->setValue("Transparency", (bool)entry.transparent);
418 if (entry.fontWeight != ColorEntry::UseCurrentFormat)
419 {
420 s->setValue("Bold", entry.fontWeight == ColorEntry::Bold);
421 }
422 s->endGroup();
423 }
424 #if 0
425 // implemented upstream - user apps
426 void ColorScheme::writeColorEntry(KConfig& config , const QString& colorName, const ColorEntry& entry , const RandomizationRange& random) const
427 {
428 KConfigGroup configGroup(&config,colorName);
429
430 configGroup.writeEntry("Color",entry.color);
431 configGroup.writeEntry("Transparency",(bool)entry.transparent);
432 if (entry.fontWeight != ColorEntry::UseCurrentFormat)
433 {
434 configGroup.writeEntry("Bold",entry.fontWeight == ColorEntry::Bold);
435 }
436
437 // record randomization if this color has randomization or
438 // if one of the keys already exists
439 if ( !random.isNull() || configGroup.hasKey("MaxRandomHue") )
440 {
441 configGroup.writeEntry("MaxRandomHue",(int)random.hue);
442 configGroup.writeEntry("MaxRandomValue",(int)random.value);
443 configGroup.writeEntry("MaxRandomSaturation",(int)random.saturation);
444 }
445 }
446 #endif
447
448 //
449 // Work In Progress - A color scheme for use on KDE setups for users
450 // with visual disabilities which means that they may have trouble
451 // reading text with the supplied color schemes.
452 //
453 // This color scheme uses only the 'safe' colors defined by the
454 // KColorScheme class.
455 //
456 // A complication this introduces is that each color provided by
457 // KColorScheme is defined as a 'background' or 'foreground' color.
458 // Only foreground colors are allowed to be used to render text and
459 // only background colors are allowed to be used for backgrounds.
460 //
461 // The ColorEntry and TerminalDisplay classes do not currently
462 // support this restriction.
463 //
464 // Requirements:
465 // - A color scheme which uses only colors from the KColorScheme class
466 // - Ability to restrict which colors the TerminalDisplay widget
467 // uses as foreground and background color
468 // - Make use of KGlobalSettings::allowDefaultBackgroundImages() as
469 // a hint to determine whether this accessible color scheme should
470 // be used by default.
471 //
472 //
473 // -- Robert Knight <[email protected]> 21/07/2007
474 //
475 AccessibleColorScheme::AccessibleColorScheme()
476 : ColorScheme()
477 {
478 #if 0
479 // It's not finished in konsole and it breaks Qt4 compilation as well
480 // basic attributes
481 setName("accessible");
482 setDescription(QObject::tr("Accessible Color Scheme"));
483
484 // setup colors
485 const int ColorRoleCount = 8;
486
487 const KColorScheme colorScheme(QPalette::Active);
488
489 QBrush colors[ColorRoleCount] =
490 {
491 colorScheme.foreground( colorScheme.NormalText ),
492 colorScheme.background( colorScheme.NormalBackground ),
493
494 colorScheme.foreground( colorScheme.InactiveText ),
495 colorScheme.foreground( colorScheme.ActiveText ),
496 colorScheme.foreground( colorScheme.LinkText ),
497 colorScheme.foreground( colorScheme.VisitedText ),
498 colorScheme.foreground( colorScheme.NegativeText ),
499 colorScheme.foreground( colorScheme.NeutralText )
500 };
501
502 for ( int i = 0 ; i < TABLE_COLORS ; i++ )
503 {
504 ColorEntry entry;
505 entry.color = colors[ i % ColorRoleCount ].color();
506
507 setColorTableEntry( i , entry );
508 }
509 #endif
510 }
511
512 ColorSchemeManager::ColorSchemeManager()
513 : _haveLoadedAll(false)
514 {
515 }
516 ColorSchemeManager::~ColorSchemeManager()
517 {
518 QHashIterator<QString,const ColorScheme*> iter(_colorSchemes);
519 while (iter.hasNext())
520 {
521 iter.next();
522 delete iter.value();
523 }
524 }
525 void ColorSchemeManager::loadAllColorSchemes()
526 {
527 //qDebug() << "loadAllColorSchemes";
528 int failed = 0;
529
530 QList<QString> nativeColorSchemes = listColorSchemes();
531 QListIterator<QString> nativeIter(nativeColorSchemes);
532 while ( nativeIter.hasNext() )
533 {
534 if ( !loadColorScheme( nativeIter.next() ) )
535 failed++;
536 }
537
538 /*if ( failed > 0 )
539 qDebug() << "failed to load " << failed << " color schemes.";*/
540
541 _haveLoadedAll = true;
542 }
543 QList<const ColorScheme*> ColorSchemeManager::allColorSchemes()
544 {
545 if ( !_haveLoadedAll )
546 {
547 loadAllColorSchemes();
548 }
549
550 return _colorSchemes.values();
551 }
552 #if 0
553 void ColorSchemeManager::addColorScheme(ColorScheme* scheme)
554 {
555 _colorSchemes.insert(scheme->name(),scheme);
556
557 // save changes to disk
558 QString path = KGlobal::dirs()->saveLocation("data","konsole/") + scheme->name() + ".colorscheme";
559 KConfig config(path , KConfig::NoGlobals);
560
561 scheme->write(config);
562 }
563 #endif
564
565 bool ColorSchemeManager::loadCustomColorScheme(const QString& path)
566 {
567 if (path.endsWith(QLatin1String(".colorscheme")))
568 return loadColorScheme(path);
569
570 return false;
571 }
572
573 void ColorSchemeManager::addCustomColorSchemeDir(const QString& custom_dir)
574 {
575 add_custom_color_scheme_dir(custom_dir);
576 }
577
578 bool ColorSchemeManager::loadColorScheme(const QString& filePath)
579 {
580 if ( !filePath.endsWith(QLatin1String(".colorscheme")) || !QFile::exists(filePath) )
581 return false;
582
583 QFileInfo info(filePath);
584
585 const QString& schemeName = info.baseName();
586
•587 ColorScheme* scheme = new ColorScheme(this);
588 scheme->setName(schemeName);
589 scheme->read(filePath);
590
591 if (scheme->name().isEmpty())
592 {
593 //qDebug() << "Color scheme in" << filePath << "does not have a valid name and was not loaded.";
594 delete scheme;
595 return false;
596 }
597
598 if ( !_colorSchemes.contains(schemeName) )
599 {
600 _colorSchemes.insert(schemeName,scheme);
601 }
602 else
603 {
604 /*qDebug() << "color scheme with name" << schemeName << "has already been" <<
605 "found, ignoring.";*/
606
607 delete scheme;
608 }
609
610 return true;
611 }
612 QList<QString> ColorSchemeManager::listColorSchemes()
613 {
614 QList<QString> ret;
615 for (const QString &scheme_dir : get_color_schemes_dirs())
616 {
617 const QString dname(scheme_dir);
618 QDir dir(dname);
619 QStringList filters;
620 filters << QLatin1String("*.colorscheme");
621 dir.setNameFilters(filters);
622 const QStringList list = dir.entryList(filters);
623 for (const QString &i : list)
624 ret << dname + QLatin1Char('/') + i;
625 }
626 return ret;
627 // return KGlobal::dirs()->findAllResources("data",
628 // "konsole/*.colorscheme",
629 // KStandardDirs::NoDuplicates);
630 }
631 const ColorScheme ColorSchemeManager::_defaultColorScheme;
632 const ColorScheme* ColorSchemeManager::defaultColorScheme() const
633 {
634 return &_defaultColorScheme;
635 }
636 bool ColorSchemeManager::deleteColorScheme(const QString& name)
637 {
638 Q_ASSERT( _colorSchemes.contains(name) );
639
640 // lookup the path and delete
641 QString path = findColorSchemePath(name);
642 if ( QFile::remove(path) )
643 {
644 _colorSchemes.remove(name);
645 return true;
646 }
647 else
648 {
649 //qDebug() << "Failed to remove color scheme -" << path;
650 return false;
651 }
652 }
653 QString ColorSchemeManager::findColorSchemePath(const QString& name) const
654 {
655 // QString path = KStandardDirs::locate("data","konsole/"+name+".colorscheme");
656 const QStringList dirs = get_color_schemes_dirs();
657 if ( dirs.isEmpty() )
658 return QString();
659
660 const QString dir = dirs.first();
661 QString path(dir + QLatin1Char('/')+ name + QLatin1String(".colorscheme"));
662 if ( !path.isEmpty() )
663 return path;
664
665 //path = KStandardDirs::locate("data","konsole/"+name+".schema");
666 path = dir + QLatin1Char('/')+ name + QLatin1String(".schema");
667
668 return path;
669 }
•670 const Konsole::ColorScheme* ColorSchemeManager::findColorScheme(const QString& name)
671 {
672 if ( name.isEmpty() )
673 return defaultColorScheme();
674
675 if ( _colorSchemes.contains(name) )
676 return _colorSchemes[name];
677 else
678 {
679 // look for this color scheme
680 QString path = findColorSchemePath(name);
681 if ( !path.isEmpty() && loadColorScheme(path) )
682 {
683 return findColorScheme(name);
684 }
685
686 //qDebug() << "Could not find color scheme - " << name;
687
688 return nullptr;
689 }
690 }
691 Q_GLOBAL_STATIC(ColorSchemeManager, theColorSchemeManager)
692 ColorSchemeManager* ColorSchemeManager::instance()
693 {
694 return theColorSchemeManager;
695 }