ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ColorScheme.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include "PythonHighlighter.h"
11 
13 class ColorScheme final
14 {
15  public:
16  using Vector = std::vector<ColorScheme>;
17 
19  static const Vector &AvailableColorSchemes();
22  static const ColorScheme *ColorSchemeByName(const QString &name);
23 
25  static ColorScheme Default();
28  static ColorScheme Dracula();
29 
31  const QString &name() const;
33  QColor backgroundColor() const;
35  QColor foregroundColor() const;
37  QColor currentLineHighlightColor() const;
38 
40  const QTextCharFormat &operator[](PythonHighlighter::CodeElement e) const;
41 
42  private:
43  ColorScheme(QString name,
44  QVector<QTextCharFormat> &&formats,
45  const QTextFormat &defaultFormat,
46  QColor backgroundColor,
48 
49  private:
50  QString m_name;
51  QVector<QTextCharFormat> m_formats;
52  QTextFormat m_defaultFormat;
53  QColor m_backgroundColor;
54  QColor m_currentLineHighlightColor;
55 };
ColorScheme to be used by the PythonHighlighter & Editor.
Definition: ColorScheme.h:14
static ColorScheme Dracula()
Definition: ColorScheme.cpp:88
QColor foregroundColor() const
Color to be used for regular text.
Definition: ColorScheme.cpp:47
const QString & name() const
The name of the color scheme.
QColor currentLineHighlightColor() const
Color to be used if a highlight of the current line is shown.
Definition: ColorScheme.cpp:57
static const Vector & AvailableColorSchemes()
Returns the vector of available color schemes.
const QTextCharFormat & operator[](PythonHighlighter::CodeElement e) const
Returns the format to be used for the given code element.
Definition: ColorScheme.cpp:62
static ColorScheme Default()
Default color scheme.
Definition: ColorScheme.cpp:69
std::vector< ColorScheme > Vector
Definition: ColorScheme.h:16
static const ColorScheme * ColorSchemeByName(const QString &name)
QColor backgroundColor() const
Color to be used as the background for the displayed text.
Definition: ColorScheme.cpp:52