Skip to content

GUI.ColorPalette

Adam Furman edited this page Jul 9, 2016 · 1 revision

ColorPalette class

The ColorPalette class provides colors that go together to form consistent app themes. They are organized in three categories, "light", "normal", and "dark". An example of the "light" theme is are the file-reader and editor apps, while the "dark" theme is used in about, and the "normal" theme in files.

GUI.ColorPalette ()

Accessible via state.getColorPalette()

Static Methods

  • loadFromFile ( str path ) Load custom color palettes from a file. Returns a ColorPalette object.

Object Variables

  • dict palette The color palette itself. The first set of keys are the themes, e.g. "light", "dark". The second set are the colors themselves.
  • str scheme The current scheme (theme).

Methods

  • getPalette () Return the palette dict.
  • getScheme () Return the current scheme name.
  • setScheme ( name="normal" ) Set the scheme to the given name.
  • getColor ( str item ) Returns an RGB(A) tuple with the requested color. See the details below.

Note that ColorPalette supports retrieving colors via __getitem__.

Colors and Notation

The default color palette is below.

{
   "normal": {
              "background": (200, 200, 200),
              "item": (20, 20, 20),
              "accent": (100, 100, 200),
              "warning": (250, 160, 45),
              "error": (250, 50, 50)
              },
   "dark": {
            "background": (50, 50, 50),
            "item": (220, 220, 220),
            "accent": (50, 50, 150),
            "warning": (200, 110, 0),
            "error": (200, 0, 0)
            },
   "light": {
             "background": (250, 250, 250),
             "item": (50, 50, 50),
             "accent": (150, 150, 250),
             "warning": (250, 210, 95),
             "error": (250, 100, 100)
             }
}

When requesting colors using the getColor method, Python OS supports using modifiers. Modifiers change the shade of valid color names.

  • darker:color Darkens the shade of color by 20.
  • dark:color Darkens the shade of color by 40.
  • lighter:color Lightens the shade of color by 20.
  • light:color Lightens the shade of color by 40.
  • transparent:color:percent Adds an alpha value corresponding to percent.

Home

Getting Started

Documentation

Threads and Tasks

Applications and Notifications

The State Class and Variable

The GUI, Events, Resources, and Dialogs

The following classes are all under the GUI class, e.g. Font is actually accessed as GUI.Font.

  • Font class
  • Icons class
  • ColorPalette class
  • LongClickEvent class
  • IntermediateUpdateEvent class
  • EventQueue class
  • FunctionBar class
  • Keyboard class
  • Overlay class
  • Dialog class
    • OKDialog dialog
    • ErrorDialog dialog
    • WarningDialog dialog
    • YNDialog dialog
    • OKCancelDialog dialog
    • AskDialog dialog
    • CustomContentDialog dialog
  • NotificationMenu overlay
    • RecentAppSwitcher overlay
    • Selector overlay

GUI Components and Containers

  • Component class

The following classes are all Components, they inherit from that class.

  • Container component
  • AppContainer container
  • Button container
  • KeyboardButton container
  • TextEntryField container
  • PagedContainer container
    • GriddedPagedContainer container
    • ListedPagedContainer container
  • ButtonRow container
  • ScrollableContainer container
    • ListScrollableContainer container
    • TextScrollableContainer container
    • MultiLineTextEntryField container
  • Text component
  • MultiLineText component
  • ExpandingMultiLineText component
  • Image component
  • Slider component
  • Checkbox component
  • Switch component
  • Canvas component
  • ScrollIndicator component
Clone this wiki locally