File: owpalette.py

package info (click to toggle)
orange3 3.40.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,908 kB
  • sloc: python: 162,745; ansic: 622; makefile: 322; sh: 93; cpp: 77
file content (35 lines) | stat: -rw-r--r-- 886 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from AnyQt.QtGui import QPalette
from AnyQt.QtCore import Qt
import pyqtgraph as pg

__all__ = ["create_palette", "OWPalette"]


pg.setConfigOptions(antialias=True)


def create_palette(colors):
    p = QPalette()
    for role, color in colors.items():
        p.setColor(role, color)
    return p


class OWPalette:
    """
        These constants are defined here so that they can be changed without
        extensive changes to the visualizations
    """
    Canvas = QPalette.Base
    Grid = QPalette.Button
    Text = QPalette.Text
    Data = QPalette.Text
    Axis = QPalette.Text

    System = QPalette()
    Light = create_palette({Canvas: Qt.white,
                            Grid: Qt.lightGray,
                            Text: Qt.black})
    Dark = create_palette({Canvas: Qt.black,
                           Grid: Qt.darkGray,
                           Text: Qt.white})