-
Notifications
You must be signed in to change notification settings - Fork 11
1.04 Fonts and colors
In the interest of making Lokasenna_GUI as straightforward as possible, and since Reaper's API does the opposite, fonts are handled by way of presets.
1 -- Title
2 -- Header
3 -- Label
4 -- Value
GUI.font(2)
Most classes will have one or two font parameters:
GUI.elms.my_label.font = 3
Presets can be overridden or added to at any point:
font size flags
GUI.fonts[4] = {"Calibri", 12, "bi"}
GUI.fonts[5] = {"Arial", 10}
GUI.fonts["meme"] = {"Impact", 20, "b"}
GUI.font will also directly accept a table in the same format.
The default presets all use the same font, and are OS-dependent. As of this writing they are:
- Windows: Calibri
- OSX: Helvetica Neue
- Linux: Arial
Textbox and TextEditor elements need a monospace font for their content. By default:
- Windows: Lucida Console
- OSX: Andale Mono
- Linux: DejaVu Sans Mono
Note: On OSX, font sizes are multiplied by 0.7 at runtime because Mac and Windows apparently can't agree on something as simple as font sizes.
Colors are dealt with in a similar fashion.
wnd_bg -- Window BG
tab_bg -- Tabs BG
elm_bg -- Element BG
elm_frame -- Element Frame
elm_fill -- Element Fill
elm_outline -- Element Outline
txt -- Text
GUI.color("elm_fill")
GUI.elms.my_label.color = "cyan"
As with fonts, the color presets can be added to or amended:
R G B A
GUI.colors["red"] = {16, 103, 192, 255}
GUI.colors["my_ugly_button"] = {96, 128, 192, 255}
And GUI.color can likewise be given a color table directly.
The 16 standard web colors are also available, by name: GUI.color("magenta")
Important: Prior to calling GUI.Init, the color presets are stored as 0-255 values. Init converts them to 0-1, since that's what REAPER's gfx functions use. Be aware of this if you need to work with any color values directly after the script has started. In all honesty, though, you probably won't need to.
Some scripts may need to tinker with the gfx color values directly, for instance to create the
Label class' :fade. This is perfectly fine, but make sure you set gfx.a = 1
when you're
finished. GUI.Main checks it a couple of times, but forgetting to reset a can mess up the
appearance of the entire GUI.
Introduction
- 1. Getting started
- 2. Parts of a basic script
- 3. How it works
- 4. Fonts and colors
- 5. Element methods
Elements
- 1. Button
- 2. Frame
- 3. Knob
- 4. Label
- 5. Listbox
- 6. Menubar
- 7. Menubox
- 8. Options
- 9. Slider
- 10. Tabs
- 11. Textbox
- 12. TextEditor
- 13. Window
Core functions
- 1. Element creation
- 2. GUI variables
- 3. Script hooks
- 4. Table functions
- 5. Text functions
- 6. Color functions
- 7. Math and Logic functions
- 8. Graphics functions
- 9. Element functions
Additional documentation