schrodinger.application.matsci.stylemanager module

Module to manage styles for matsci widgets

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.stylemanager.ColorProvider(*args, **kwargs)

Bases: Protocol

Interface for classes that provide colors based on light/dark mode

getColors(light_mode=True)

Get colors based on light/dark mode

Parameters

light_mode (bool) – If True, get colors from dark to light (skip lightest shade). If False, get colors from light to dark (skip darkest shade)

Returns

List of colors in hex format

Return type

List[str]

__init__(*args, **kwargs)
class schrodinger.application.matsci.stylemanager.ShadeDefinition(name: str, colors: List[str])

Bases: schrodinger.application.matsci.stylemanager.ColorProvider

Define shade colors for a solid color

name: str
colors: List[str]
getColors(light_mode=True)

Get colors based on light/dark mode

Parameters

light_mode (bool) – If True, get colors from dark to light (skip lightest shade). If False, get colors from light to dark (skip darkest shade)

Returns

List of colors in hex format

Return type

List[str]

__init__(name: str, colors: List[str]) None
class schrodinger.application.matsci.stylemanager.GradientDefinition(name: str, start_color: schrodinger.application.matsci.stylemanager.SolidColors, end_color: schrodinger.application.matsci.stylemanager.SolidColors, steps: int = 5)

Bases: schrodinger.application.matsci.stylemanager.ColorProvider

Gradient definition between two colors with pre-computed intermediate steps

name: str
start_color: schrodinger.application.matsci.stylemanager.SolidColors
end_color: schrodinger.application.matsci.stylemanager.SolidColors
steps: int = 5
getColors(light_mode=True)

Get colors for gradient with pre-computed intermediate steps

Parameters

light_mode (bool) – Not used for gradients, kept for ColorProvider interface

Returns

List of interpolated colors in hex format

Return type

List[str]

__init__(name: str, start_color: schrodinger.application.matsci.stylemanager.SolidColors, end_color: schrodinger.application.matsci.stylemanager.SolidColors, steps: int = 5) None
class schrodinger.application.matsci.stylemanager.SolidColors

Bases: enum.StrEnum

Define solid colors as described in https://brandguides.brandfolder.com/schrodinger-brand-guide/color

TRUE_BLACK = '#000000'
BLACK = '#12122D'
WHITE = '#FFFFFF'
DARK_BLUE = '#005AAA'
LIGHT_BLUE = '#54C9EF'
GREEN = '#4CB748'
LIGHT_GREEN = '#77C267'
RED = '#EE2624'
LIGHT_RED = '#F15E40'
PURPLE = '#53469C'
LIGHTEST_GRAY = '#F1EFED'
LIGHT_GRAY = '#C6C5C5'
BACKGROUND_LIGHT_GRAY = '#F5F5F5'
BORDER_GRAY = '#E0E0E0'
ORANGE = '#F37C28'
YELLOW = '#F8ED41'
DARK_GRAY = '#525254'
ERROR_TEXT = '#cc0000'
class schrodinger.application.matsci.stylemanager.Shades

Bases: enum.Enum

Define shades of colors. All shade are defined from darkest to lightest as described in https://brandguides.brandfolder.com/schrodinger-brand-guide/color

GREEN = ShadeDefinition(name='GREEN', colors=[<SolidColors.GREEN: '#4CB748'>, <SolidColors.LIGHT_GREEN: '#77C267'>, '#77C267', '#98CF8B', '#BADDAE', '#DBEDD4'])
RED = ShadeDefinition(name='RED', colors=[<SolidColors.RED: '#EE2624'>, <SolidColors.LIGHT_RED: '#F15E40'>, '#F58666', '#F9AB90', '#FCD3C1'])
PURPLE = ShadeDefinition(name='PURPLE', colors=['#53469C', '#6E62AB', '#8B7FBC', '#ABA2D0', '#D0CCE6'])
ORANGE = ShadeDefinition(name='ORANGE', colors=['#F37C28', '#F4934E', '#F7AC75', '#FBC69D', '#FCE0C9'])
GRAY = ShadeDefinition(name='GRAY', colors=[<SolidColors.DARK_GRAY: '#525254'>, '#7B7B7D', '#9F9E9F', <SolidColors.LIGHT_GRAY: '#C6C5C5'>, <SolidColors.LIGHTEST_GRAY: '#F1EFED'>])
YELLOW = ShadeDefinition(name='YELLOW', colors=['#525122', '#7A7830', '#A29D2B', '#CBC438', '#F8ED41'])
class schrodinger.application.matsci.stylemanager.Gradients

Bases: enum.Enum

Define gradients between two colors as described in https://brandguides.brandfolder.com/schrodinger-brand-guide/color

DB_LB = GradientDefinition(name='DB_LB', start_color=<SolidColors.DARK_BLUE: '#005AAA'>, end_color=<SolidColors.LIGHT_BLUE: '#54C9EF'>, steps=5)
OXYGEN_IODINE = GradientDefinition(name='OXYGEN_IODINE', start_color=<SolidColors.RED: '#EE2624'>, end_color=<SolidColors.PURPLE: '#53469C'>, steps=5)
PHOSPHORUS_OXYGEN = GradientDefinition(name='PHOSPHORUS_OXYGEN', start_color=<SolidColors.ORANGE: '#F37C28'>, end_color=<SolidColors.RED: '#EE2624'>, steps=5)
SULFUR_PHOSPHORUS = GradientDefinition(name='SULFUR_PHOSPHORUS', start_color=<SolidColors.YELLOW: '#F8ED41'>, end_color=<SolidColors.ORANGE: '#F37C28'>, steps=5)
SULFUR_FLORINE = GradientDefinition(name='SULFUR_FLORINE', start_color=<SolidColors.YELLOW: '#F8ED41'>, end_color=<SolidColors.GREEN: '#4CB748'>, steps=5)
IODINE_DB = GradientDefinition(name='IODINE_DB', start_color=<SolidColors.PURPLE: '#53469C'>, end_color=<SolidColors.DARK_BLUE: '#005AAA'>, steps=5)
schrodinger.application.matsci.stylemanager.hex_to_rgb(hex_color)

Convert hex color to RGB tuple

Parameters

hex_color (str) – Hex color string eg ‘#FFFFFF’ for white or ‘#000000’ for black. Note alpha channel is not supported

Returns

RGB tuple where each value is between 0 and 1

Return type

tuple(float, float, float)

schrodinger.application.matsci.stylemanager.rgb_to_hex(rgb_color)

Convert RGB tuple to hex color string

Parameters

rgb_color (tuple[float, float, float]) – RGB tuple with values between 0 and 1

Returns

Hex color string

Return type

str

schrodinger.application.matsci.stylemanager.interpolate_color(color1, color2, fraction)

Interpolate between two RGB colors

Parameters
  • color1 (tuple[float, float, float]) – RGB tuple for first color

  • color2 (tuple[float, float, float]) – RGB tuple for second color

  • fraction (float) – Fraction between 0 and 1 to interpolate

Returns

Interpolated RGB tuple

Return type

tuple[float, float, float]

schrodinger.application.matsci.stylemanager.get_gradient(gradient_name, num_colors, light_mode=True)

Get a gradient with specified number of colors.

Parameters
  • gradient_name (Gradients | Shades) – Gradient or shade name

  • num_colors (int) – Number of colors needed

  • light_mode (bool) – If True, skip lightest shade in light mode, darkest in dark mode

Returns

List of RGB tuples (values 0-1)

Return type

list[tuple[float, float, float]]

class schrodinger.application.matsci.stylemanager.ColorCycle(shades_list=None, light_mode=True)

Bases: object

Manages continuous cycling through color shades

__init__(shades_list=None, light_mode=True)

Initialize color cycle

Parameters
  • shades_list (list[Shades] | None) – List of shades to cycle through. If None, use all shades

  • light_mode (bool) – If True cycle through shades from dark to light. If False, cycle through shades from light to dark. Note that lightest shade is skipped in light mode, darkest in dark mode.

getBatch(num_colors)

Get a batch of colors

Parameters

num_colors (int) – Number of colors needed

Returns

List of RGB tuples (values 0-1)

Return type

list[tuple[float, float, float]]

reset()

Reset cycle to beginning

schrodinger.application.matsci.stylemanager.cycle_shades(num_colors, shades_list=None, light_mode=True)

Cycle through shades of colors.

Parameters
  • num_colors (int) – Number of colors needed

  • shades_list (list[Shades] | None) – List of shades to cycle through. If None, cycle through all shades

  • light_mode (bool) – If True, skip lightest shade in light mode, darkest in dark mode

Returns

List of RGB tuples (values 0-1)

Return type

list[tuple[float, float, float]]

class schrodinger.application.matsci.stylemanager.Margin

Bases: enum.Enum

NONE = '0px'
SMALL = '2px'
class schrodinger.application.matsci.stylemanager.Padding

Bases: enum.Enum

NONE = '0px'
SMALL = '2px'
schrodinger.application.matsci.stylemanager.apply_style(widget, style_text, object_name=None)

Apply the style to the widget

Parameters
  • widget (QtWidgets.QWidget) – The widget to apply the style to

  • style_text (str) – The style text to apply

  • object_name (str) – The name to assign to the widget for styling purposes, this allows the style to not be applied to all widgets of the same type

schrodinger.application.matsci.stylemanager.apply_basic_style(widget, background_color=None, border=None, padding=None, margin=None, color=None, font_style=None, object_name=None)

Apply a basic style to the widget with customizable properties

Parameters
  • widget (QtWidgets.QWidget) – The widget to apply the style to

  • background_color (str) – The background color to apply

  • border (str) – The border style to apply

  • padding (str) – The padding to apply

  • margin (str) – The margin to apply

  • color (str) – The text color to apply

  • font_style (str) – The font style to apply

  • object_name (str) – The name to assign to the widget for styling purposes

schrodinger.application.matsci.stylemanager.info_text_style(widget)

Apply the info text style to the widget

Parameters

widget (QtWidgets.QWidget) – The widget to apply info text style to

schrodinger.application.matsci.stylemanager.error_text_style(widget)

Apply the error text style to the widget

Parameters

widget (QtWidgets.QWidget) – The widget to apply error text style to

schrodinger.application.matsci.stylemanager.transparent_style(widget, object_name=None)

Apply the transparent background style to the widget

Parameters
  • widget (QtWidgets.QWidget) – The widget to apply the transparent background style to

  • object_name (str or None) – The name to assign to the widget for styling purposes if None, a unique name will be generated

schrodinger.application.matsci.stylemanager.frame_style(widget, object_name=None)

Apply the group frame style to the widget

Parameters
  • widget (QtWidgets.QWidget) – The widget to apply the group frame style to

  • object_name (str or None) – The name to assign to the widget for styling purposes if None, a unique name will be generated

schrodinger.application.matsci.stylemanager.emphasized_widget_style(widget, object_name=None)

Apply the emphasized widget style to the widget

Parameters
  • widget (QtWidgets.QWidget) – The widget to apply the emphasized widget style to

  • object_name (str or None) – The name to assign to the widget for styling purposes if None, a unique name will be generated

schrodinger.application.matsci.stylemanager.more_emphasized_widget_style(widget, object_name=None)

Apply the stage frame style to the widget

Parameters
  • widget (QtWidgets.QWidget) – The widget to apply the stage frame style to

  • object_name (str or None) – The name to assign to the widget for styling purposes if None, a unique name will be generated

schrodinger.application.matsci.stylemanager.even_row_style(widget)

Apply the even row style to the widget

Parameters

widget (QtWidgets.QWidget) – The widget to apply the even row style to

schrodinger.application.matsci.stylemanager.odd_row_style(widget)

Apply the odd row style to the widget

Parameters

widget (QtWidgets.QWidget) – The widget to apply the odd row style to

schrodinger.application.matsci.stylemanager.highlight_style(widget)

Apply the highlight style to the widget

Parameters

widget (QtWidgets.QWidget) – The widget to apply the highlight style to

schrodinger.application.matsci.stylemanager.apply_white_background(widget, object_name=None)

Apply the white background style to the widget

Parameters
  • widget (QtWidgets.QWidget) – The widget to apply the white background style to

  • object_name (str or None) – The name to assign to the widget for styling purposes if None, a unique name will be generated