qrainbowstyle package

Subpackages

Submodules

qrainbowstyle.colorsystem module

class qrainbowstyle.colorsystem.Blue[source]

Bases: object

B0 = '#000000'
B10 = '#062647'
B100 = '#9FCBFF'
B110 = '#C2DFFA'
B120 = '#CEE8FF'
B130 = '#DAEDFF'
B140 = '#F5FAFF'
B150 = '##FFFFFF'
B20 = '#26486B'
B30 = '#375A7F'
B40 = '#346792'
B50 = '#1A72BB'
B60 = '#057DCE'
B70 = '#259AE9'
B80 = '#37AEFE'
B90 = '#73C7FF'
class qrainbowstyle.colorsystem.Gray[source]

Bases: object

B0 = '#000000'
B10 = '#19232D'
B100 = '#B9BDC1'
B110 = '#C9CDD0'
B120 = '#CED1D4'
B130 = '#E0E1E3'
B140 = '#FAFAFA'
B150 = '#FFFFFF'
B20 = '#293544'
B30 = '#37414F'
B40 = '#455364'
B50 = '#54687A'
B60 = '#60798B'
B70 = '#788D9C'
B80 = '#9DA9B5'
B90 = '#ACB1B6'
class qrainbowstyle.colorsystem.Green[source]

Bases: object

B0 = '#000000'
B10 = '#064738'
B100 = '#88F2D3'
B110 = '#B0F5E1'
B120 = '#D1FBEE'
B130 = '#E4FFF7'
B140 = '#F5FFFD'
B150 = '#FFFFFF'
B20 = '#055C49'
B30 = '#007A5E'
B40 = '#008760'
B50 = '#019D70'
B60 = '#02BA85'
B70 = '#20C997'
B80 = '#44DEB0'
B90 = '#3BEBB7'
class qrainbowstyle.colorsystem.GroupDark[source]

Bases: object

B10 = '#E11C1C'
B100 = '#AF2294'
B110 = '#DB4D8E'
B120 = '#38D4A4'
B20 = '#FF8A00'
B30 = '#88BA00'
B40 = '#2DB500'
B50 = '#3FC6F0'
B60 = '#107EEC'
B70 = '#5C47E0'
B80 = '#7F27C5'
B90 = '#C88AFA'
class qrainbowstyle.colorsystem.GroupLight[source]

Bases: object

B10 = '#FF6700'
B100 = '#CC2782'
B110 = '#FF71BF'
B120 = '#7EE8C7'
B20 = '#FFB000'
B30 = '#FFE600'
B40 = '#7FDD05'
B50 = '#00A585'
B60 = '#22BCF2'
B70 = '#1256CC'
B80 = '#803AD0'
B90 = '#B568F2'
class qrainbowstyle.colorsystem.Orange[source]

Bases: object

B0 = '#000000'
B10 = '#471D06'
B100 = '#FFCF84'
B110 = '#FFDDA7'
B120 = '#FFEACA'
B130 = '#FFF3E2'
B140 = '#FFFBF5'
B150 = '#FFFFFF'
B20 = '#692907'
B30 = '#AB3E00'
B40 = '#CE4B01'
B50 = '#E05E15'
B60 = '#E57004'
B70 = '#F37E12'
B80 = '#FF993B'
B90 = '#FFB950'
class qrainbowstyle.colorsystem.Red[source]

Bases: object

B0 = '#000000'
B10 = '#470606'
B100 = '#FFACA4'
B110 = '#FFC3BD'
B120 = '#FEDDDA'
B130 = '#FFEEEE'
B140 = '#FFF5F5'
B150 = '#FFFFFF'
B20 = '#760B0B'
B30 = '#AF0F0F'
B40 = '#D4140B'
B50 = '#DE321F'
B60 = '#E24232'
B70 = '#E74C3C'
B80 = '#F66657'
B90 = '#F88478'

qrainbowstyle.palette module

QRainbowStyle default palette.

class qrainbowstyle.palette.BasePalette[source]

Bases: object

Base class for palettes.

BORDER_1 = '1px solid $COLOR_BACKGROUND_1'
BORDER_2 = '1px solid $COLOR_BACKGROUND_4'
BORDER_3 = '1px solid $COLOR_BACKGROUND_6'
BORDER_SELECTION_1 = '1px solid $COLOR_ACCENT_1'
BORDER_SELECTION_2 = '1px solid $COLOR_ACCENT_2'
BORDER_SELECTION_3 = '1px solid $COLOR_ACCENT_3'
COLOR_ACCENT_1 = ''
COLOR_ACCENT_2 = ''
COLOR_ACCENT_3 = ''
COLOR_ACCENT_4 = ''
COLOR_ACCENT_5 = ''
COLOR_BACKGROUND_1 = ''
COLOR_BACKGROUND_2 = ''
COLOR_BACKGROUND_3 = ''
COLOR_BACKGROUND_4 = ''
COLOR_BACKGROUND_5 = ''
COLOR_BACKGROUND_6 = ''
COLOR_TEXT_1 = ''
COLOR_TEXT_2 = ''
COLOR_TEXT_3 = ''
COLOR_TEXT_4 = ''
OPACITY_TOOLTIP = 0
PATH_RESOURCES = "':/qss_icons'"
SIZE_BORDER_RADIUS = '4px'
TITLE_BAR_BACKGROUND_COLOR = ''
TITLE_BAR_BUTTONS_DISABLED_COLOR = ''
TITLE_BAR_BUTTONS_HOVER_COLOR = ''
TITLE_BAR_TEXT_COLOR = ''
classmethod color_palette()[source]

Return the ordered colored palette dictionary.

classmethod to_dict(colors_only=False)[source]

Convert variables to dictionary.

class qrainbowstyle.palette.DarkOrange[source]

Bases: qrainbowstyle.palette.BasePalette

COLOR_ACCENT_1 = '#ce4b01'
COLOR_ACCENT_2 = '#d66522'
COLOR_ACCENT_3 = '#de8044'
COLOR_ACCENT_4 = '#e79b65'
COLOR_ACCENT_5 = '#efb587'
COLOR_BACKGROUND_1 = '#19232D'
COLOR_BACKGROUND_2 = '#293544'
COLOR_BACKGROUND_3 = '#37414F'
COLOR_BACKGROUND_4 = '#455364'
COLOR_BACKGROUND_5 = '#54687A'
COLOR_BACKGROUND_6 = '#60798B'
COLOR_TEXT_1 = '#E0E1E3'
COLOR_TEXT_2 = '#C9CDD0'
COLOR_TEXT_3 = '#ACB1B6'
COLOR_TEXT_4 = '#9DA9B5'
OPACITY_TOOLTIP = 230
TITLE_BAR_BACKGROUND_COLOR = '#de8044'
TITLE_BAR_BUTTONS_DISABLED_COLOR = '#ce4b01'
TITLE_BAR_BUTTONS_HOVER_COLOR = '#e79b65'
TITLE_BAR_TEXT_COLOR = '#E0E1E3'
class qrainbowstyle.palette.LightOrange[source]

Bases: qrainbowstyle.palette.BasePalette

COLOR_ACCENT_1 = '#ce4b01'
COLOR_ACCENT_2 = '#d66522'
COLOR_ACCENT_3 = '#de8044'
COLOR_ACCENT_4 = '#e79b65'
COLOR_ACCENT_5 = '#efb587'
COLOR_BACKGROUND_1 = '#FAFAFA'
COLOR_BACKGROUND_2 = '#E0E1E3'
COLOR_BACKGROUND_3 = '#CED1D4'
COLOR_BACKGROUND_4 = '#C9CDD0'
COLOR_BACKGROUND_5 = '#B9BDC1'
COLOR_BACKGROUND_6 = '#ACB1B6'
COLOR_TEXT_1 = '#19232D'
COLOR_TEXT_2 = '#293544'
COLOR_TEXT_3 = '#54687A'
COLOR_TEXT_4 = '#788D9C'
OPACITY_TOOLTIP = 230
TITLE_BAR_BACKGROUND_COLOR = '#de8044'
TITLE_BAR_BUTTONS_DISABLED_COLOR = '#ce4b01'
TITLE_BAR_BUTTONS_HOVER_COLOR = '#e79b65'
TITLE_BAR_TEXT_COLOR = '#19232D'
class qrainbowstyle.palette.Oceanic[source]

Bases: qrainbowstyle.palette.BasePalette

Theme variables.

COLOR_ACCENT_1 = '#0a4542'
COLOR_ACCENT_2 = '#136460'
COLOR_ACCENT_3 = '#097D74'
COLOR_ACCENT_4 = '#56BFBA'
COLOR_ACCENT_5 = '#C4D6DB'
COLOR_BACKGROUND_1 = '#263238'
COLOR_BACKGROUND_2 = '#2f4048'
COLOR_BACKGROUND_3 = '#34474f'
COLOR_BACKGROUND_4 = '#394d57'
COLOR_BACKGROUND_5 = '#3d545f'
COLOR_BACKGROUND_6 = '#425b67'
COLOR_TEXT_1 = '#E0E1E3'
COLOR_TEXT_2 = '#C9CDD0'
COLOR_TEXT_3 = '#ACB1B6'
COLOR_TEXT_4 = '#9DA9B5'
OPACITY_TOOLTIP = 230
TITLE_BAR_BACKGROUND_COLOR = '#097D74'
TITLE_BAR_BUTTONS_DISABLED_COLOR = '#0a4542'
TITLE_BAR_BUTTONS_HOVER_COLOR = '#56BFBA'
TITLE_BAR_TEXT_COLOR = '#E0E1E3'
class qrainbowstyle.palette.QDarkStyle[source]

Bases: qrainbowstyle.palette.BasePalette

COLOR_ACCENT_1 = '#14506e'
COLOR_ACCENT_2 = '#145f87'
COLOR_ACCENT_3 = '#146998'
COLOR_ACCENT_4 = '#1478b1'
COLOR_ACCENT_5 = '#148cd2'
COLOR_BACKGROUND_1 = '#19232d'
COLOR_BACKGROUND_2 = '#27323c'
COLOR_BACKGROUND_3 = '#35414b'
COLOR_BACKGROUND_4 = '#3e4b55'
COLOR_BACKGROUND_5 = '#47555f'
COLOR_BACKGROUND_6 = '#505f69'
COLOR_TEXT_1 = '#E0E1E3'
COLOR_TEXT_2 = '#C9CDD0'
COLOR_TEXT_3 = '#ACB1B6'
COLOR_TEXT_4 = '#9DA9B5'
OPACITY_TOOLTIP = 230
TITLE_BAR_BACKGROUND_COLOR = '#146998'
TITLE_BAR_BUTTONS_DISABLED_COLOR = '#14506e'
TITLE_BAR_BUTTONS_HOVER_COLOR = '#1478b1'
TITLE_BAR_TEXT_COLOR = '#E0E1E3'
class qrainbowstyle.palette.QDarkStyle3[source]

Bases: qrainbowstyle.palette.BasePalette

COLOR_ACCENT_1 = '#26486B'
COLOR_ACCENT_2 = '#346792'
COLOR_ACCENT_3 = '#1A72BB'
COLOR_ACCENT_4 = '#259AE9'
COLOR_ACCENT_5 = '#37AEFE'
COLOR_BACKGROUND_1 = '#19232D'
COLOR_BACKGROUND_2 = '#293544'
COLOR_BACKGROUND_3 = '#37414F'
COLOR_BACKGROUND_4 = '#455364'
COLOR_BACKGROUND_5 = '#54687A'
COLOR_BACKGROUND_6 = '#60798B'
COLOR_TEXT_1 = '#E0E1E3'
COLOR_TEXT_2 = '#C9CDD0'
COLOR_TEXT_3 = '#ACB1B6'
COLOR_TEXT_4 = '#9DA9B5'
OPACITY_TOOLTIP = 230
TITLE_BAR_BACKGROUND_COLOR = '#1A72BB'
TITLE_BAR_BUTTONS_DISABLED_COLOR = '#26486B'
TITLE_BAR_BUTTONS_HOVER_COLOR = '#259AE9'
TITLE_BAR_TEXT_COLOR = '#E0E1E3'
class qrainbowstyle.palette.QDarkStyle3Light[source]

Bases: qrainbowstyle.palette.BasePalette

COLOR_ACCENT_1 = '#DAEDFF'
COLOR_ACCENT_2 = '#9FCBFF'
COLOR_ACCENT_3 = '#73C7FF'
COLOR_ACCENT_4 = '#37AEFE'
COLOR_ACCENT_5 = '#259AE9'
COLOR_BACKGROUND_1 = '#FAFAFA'
COLOR_BACKGROUND_2 = '#E0E1E3'
COLOR_BACKGROUND_3 = '#CED1D4'
COLOR_BACKGROUND_4 = '#C9CDD0'
COLOR_BACKGROUND_5 = '#B9BDC1'
COLOR_BACKGROUND_6 = '#ACB1B6'
COLOR_TEXT_1 = '#19232D'
COLOR_TEXT_2 = '#293544'
COLOR_TEXT_3 = '#54687A'
COLOR_TEXT_4 = '#788D9C'
OPACITY_TOOLTIP = 230
TITLE_BAR_BACKGROUND_COLOR = '#73C7FF'
TITLE_BAR_BUTTONS_DISABLED_COLOR = '#DAEDFF'
TITLE_BAR_BUTTONS_HOVER_COLOR = '#37AEFE'
TITLE_BAR_TEXT_COLOR = '#19232D'

Module contents

QRainbowStyle is a fully customizable stylesheet for Python and Qt applications.

This module provides a function to load pre-compiled stylesheets. To generate your own style based on custom color palette clone package from project homepage.

qrainbowstyle.windows module adds frameless windows and message boxes. From version v0.8 module supports native Windows calls. Features:

  • Borders snapping

  • Minimize, restore, close animations

  • Size grips on borders

  • Frame shadow

  • Aero shake

https://raw.githubusercontent.com/desty2k/QRainbowStyleSheet/master/images/frameless_window_v3.png

On Linux and Darwin qrainbowstyle will load class with its own implementation of these features. Due to a bug in Qt, window minimizing is not supported on MacOS.

First, start importing our module

import qrainbowstyle

Then you can get stylesheet provided by QRainbowStyle for various Qt wrappers as shown below

# PySide2
stylesheet = qrainbowstyle.load_stylesheet_pyside2(style='oceanic')
# PyQt5
stylesheet = qrainbowstyle.load_stylesheet_pyqt5(style='oceanic')

Alternatively, from environment variables provided by QtPy, Qt.Py

# QtPy
stylesheet =  qrainbowstyle.load_stylesheet(style='oceanic')
# Qt.Py
stylesheet = qrainbowstyle.load_stylesheet(style='oceanic', qt_api=Qt.__binding__)

Finally, set your QApplication with it

app.setStyleSheet(stylesheet)

To load frameless window in your app import both qrainbowstyle and qrainbowstyle.windows modules

import qrainbowstyle
import qrainbowstyle.windows

Initialize qt app and load choosen stylesheet. Next, create instances of frameless window and your master widget with content you want to show.

# Create app and load selected stylesheet
app = QtWidgets.QApplication(sys.argv)
app.setStyleSheet(qrainbowstyle.load_stylesheet(style="oceanic"))

# Package options
# qrainbowstyle.alignButtonsLeft()      # align titlebar buttons to left side
# qrainbowstyle.useDarwinButtons()      # use darwin style buttons
qrainbowstyle.setAppName("My new application")  # set global name for application
# qrainbowstyle.setAppIcon("icon.ico")    # set global app icon

# Create frameless mainwindow
win = qrainbowstyle.windows.FramelessWindow()

# Create content widget and pass reference to main window
widget = MasterWidget(win)

# Add widget to main window and show it
win.addContentWidget(widget)
win.show()

sys.exit(app.exec())

Enjoy!

qrainbowstyle.alignButtonsLeft()[source]

Align titlebar buttons to left

qrainbowstyle.getAvailablePalettes() list[source]

Get list of available palettes

qrainbowstyle.getAvailableStyles()[source]

Get list of available styles

qrainbowstyle.getCurrentPalette()[source]

Returns loaded palette

qrainbowstyle.load_stylesheet(qt_api='', style='qdarkstyle3')[source]

Load the stylesheet. Takes care of importing the rc module.

Parameters
  • qt_api (str) – Qt binding name to set QT_API environment variable. Default is ‘’, i.e PyQt5 the default QtPy binding. Possible values are pyside2, pyqt5. Not case sensitive.

  • style (str) – Style to use. Default is ‘darkblue’

Returns

the stylesheet string.

Return type

str

qrainbowstyle.load_stylesheet_pyqt5(style='darkblue')[source]

Load the stylesheet for use in a PyQt5 application.

Returns

the stylesheet string.

Return type

str

qrainbowstyle.load_stylesheet_pyside2(style='darkblue')[source]

Load the stylesheet for use in a PySide2 application.

Returns

the stylesheet string.

Return type

str

qrainbowstyle.rainbowize(text: str) str[source]

Replaces color names with hashes in text

qrainbowstyle.setAppIcon(icon_path: str)[source]

Set path to app icon which will be used in titlebars

qrainbowstyle.useDarwinButtons()[source]

Use darwin styled buttons everywhere in app