schrodinger.ui.qt.standard.colors module

class schrodinger.ui.qt.standard.colors.NativeColors

Bases: object

BLACK = '#000000'
DARK_GRAY = '#333333'
GRAY = '#808080'
GREEN = '#00ff00'
ORANGE = '#ffa500'
RED = '#ff0000'
WHITE = '#ffffff'
LAVENDER = '#ac9ae3'
class schrodinger.ui.qt.standard.colors.LightModeColors

Bases: schrodinger.ui.qt.standard.colors.NativeColors

INVALID_STATE_BORDER = '#ff0000'
STANDARD_BACKGROUND = '#ffffff'
STANDARD_BORDER = '#ffffff'
EMPHASIZED_TEXT = '#555555'
ERROR_TEXT = '#cc0000'
HEADER_TEXT = '#666666'
GOOD_TEXT = '#336622'
INFORMATIONAL_TEXT = '#666666'
LONG_ERROR_TEXT = '#990000'
STANDARD_TEXT = '#000000'
SUCCESS_TEXT = '#006633'
WARNING_TEXT = '#c87c00'
DISABLED_BUTTON_BACKGROUND = '#cccccc'
DISABLED_BUTTON_COLOR = '#eeeeee'
DISABLED_BUTTON_BORDER = '#cccccc'
HIGHLIGHTED_BUTTON_BACKGROUND = 'qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #96b260, stop:1 #87a056)'
HIGHLIGHTED_BUTTON_BORDER_DISABLED = '#bbbbbb'
HIGHLIGHTED_BUTTON_BORDER_ENABLED = '#989898'
HIGHLIGHTED_BUTTON_COLOR = '#ffffff'
HIGHLIGHTED_PRESSED_BUTTON_BACKGROUND_COLOR = '#87a056'
STANDARD_BUTTON_BACKGROUND = 'qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #dddddd, stop:1 #cccccc)'
STANDARD_BUTTON_BORDER_DISABLED = '#bbbbbb'
STANDARD_BUTTON_BORDER_ENABLED = '#989898'
STANDARD_BUTTON_COLOR = '#000000'
STANDARD_PRESSED_BUTTON_BACKGROUND_COLOR = '#aaaaaa'
PRESSED_BUTTON_COLOR = '#ffffff'
BLACK = '#000000'
DARK_GRAY = '#333333'
GRAY = '#808080'
GREEN = '#00ff00'
LAVENDER = '#ac9ae3'
ORANGE = '#ffa500'
RED = '#ff0000'
WHITE = '#ffffff'
class schrodinger.ui.qt.standard.colors.DarkModeColors

Bases: schrodinger.ui.qt.standard.colors.NativeColors

BLACK = '#000000'
DARK_GRAY = '#333333'
GRAY = '#808080'
GREEN = '#00ff00'
LAVENDER = '#ac9ae3'
ORANGE = '#ffa500'
RED = '#ff0000'
WHITE = '#ffffff'
schrodinger.ui.qt.standard.colors.get_luma(rgb)

Return the WCAG2 luma value of the given color.

See https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef for additional information.

Parameters

rgb (tuple[int] or QtGui.QColor) – Red, green, blue values (range 0-255). Rgba values are allowed but alpha is ignored.

Returns

Luma value (range 0.0 - 1.0)

Return type

float

schrodinger.ui.qt.standard.colors.get_contrast(rgb1, rgb2)

Return the contrast ratio for the given colors.

See https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html#contrast-ratiodef for additional information.

Returns

Contrast ratio (range 1.0 - 21.0)

Return type

float

schrodinger.ui.qt.standard.colors.get_contrasting_color(set_rgb, contrast=4.5, options=None)
Parameters
  • set_rgb (tuple[int] or QtGui.QColor) – Red, green, blue values (range 0-255). Rgba values are allowed but alpha is ignored.

  • contrast (float) – Contrast ratio (range 1.0 - 21.0)

  • options (iterable(tuple[int] or QtGui.QColor)) – Possible colors to contrast with set_rgb

schrodinger.ui.qt.standard.colors.is_color_dark(rgb)

For a given color, return whether it is dark. If a background color is dark, it should have a light foreground color and vice versa.

Note

This is determined using the luma value of the given color. The function returns True if the luma is less than 50% (i.e. closer to black than white) and False if the luma is greater than 50% (i.e. closer to white than black).

Parameters

rgb (tuple[int]) – Red, green, blue values (range 0-255). Rgba values are allowed but alpha is ignored.

Returns

Whether the color is dark

Return type

bool