Sha256: fa6e4fdf321f79e11f074d0bbc22dde71a6f9451f5d7efa64bfab52f289874b4

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

## Themes

The template builder (`WhirledPeas.template`) takes an optional `theme` argument. You can provide the name of a predefined theme (run `whirled_peas themes` to see a list with samples) or define you own with the following

```ruby
WhirledPeas.register_theme(:my_theme) do |theme|
  theme.bg_color = :bright_white
  theme.color = :blue
  theme.border_color = :bright_green
  theme.axis_color = :bright_red
  theme.title_font = :default
end
```

Theme settings will be used as default settings throughout the template, however theme settings can be overridden on any element.

### Theme Settings

The following theme settings override the existing default settings for all elements.

- `axis_color` - axis color for graphs (defaults to `border_color`)
- `bg_color` - background color (defaults to system color)
- `border_color` - border color (defaults to `color`)
- `border_style` - border style (defaults to `bold`)
- `color` - text color (defaults to system color)

The following theme settings provide new options that can be applied to existing settings. E.g.

```ruby
WhirledPeas.register_theme(:my_theme) do |theme|
  theme.highlight_bg_color = :bright_white
  theme.highlight_color = :red
  # ...
end

WhirledPeas.template(:my_theme) do |composer, settings|
  # ...
  composer.add_text do |composer, settings|
    composer.bg_color = :highlight
    composer.color = :highlight
    "This Is Important!!!"
  end
end
```

- `highlight_bg_color` - provides a new `:highlight` option that can be applied to `bg_color` settings (defaults to `color`)
- `highlight_color` - provides a new `:highlight` option that can be applied to `color` settings (defaults to `bg_color`)
- `title_font` - provides a new `:theme` option that can be applied to `title_font` settings (defaults to system default)

Note: the defaults for the `highlight_bg_color` and `highlight_color` options result in inverting the background and text colors.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whirled_peas-0.13.0 doc/themes.md
whirled_peas-0.12.0 doc/themes.md