rtk
¶
Main rtk module. All functions and submodules across rtk are anchored under this namespace, however this page covers rtk's core functions.
Fields not marked as read-only are user-settable values that control rtk's global behavior and appearance. Read-only fields are automatically updated by rtk throughout program execution (as appropriate).
touchscroll | boolean | read/write |
Set to true to enable touch scrolling, where scrolling |
smoothscroll | boolean | read/write |
If true, scrolling viewports with the mouse wheel or programmatically will animate (default true) |
touch_activate_delay | number | read/write |
When |
long_press_delay | number | read/write |
Number of seconds the mouse is pressed over a widget before
|
double_click_delay | number | read/write |
Interval between successive clicks before |
tooltip_delay | number | read/write |
Number of seconds where the mouse remains stationary over a widget before its
tooltip pops up (default |
light_luma_threshold | number | read/write |
When the luminance of a color (as returned by rtk.color.luma())
is above this value then the color is considered "light" for purposes of picking
appropriately contrasting text and icon colors (default |
debug | boolean | read/write |
Enables visual inspection of widget geometry by mousing over them (default |
window | rtk.Window or nil | read-only |
The last |
has_js_reascript_api | boolean | read-only |
true if the JS_ReaScriptAPI extension is installed, false otherwise |
has_sws_extension | boolean | read-only |
true if the SWS extension is installed |
script_path | string | read-only |
The full path to the directory containing the script that the REAPER action invoked |
reaper_hwnd | userdata | read-only |
hwnd of Reaper's main window |
tick | number | read-only |
Monotonically increasing counter that is incremented each gfx update cycle as long
as an |
fps | number | read-only |
Frame rate (measured on each update cycle of the main window) |
focused_hwnd | userdata | read-only |
The hwnd of the currently focused window, or nil if js_ReaScriptAPI is not installed |
focused | boolean | read-only |
The currently focused |
theme | table | read-only |
A table holding the current theme colors which is initialized via |
rtk.class() | Creates a new class |
rtk.isa() | Determine if a value is an instance or sublcass of a particular class |
rtk.add_image_search_path() | Registers an image search path where images and icons can be found by
|
rtk.set_theme() | Initializes the UI theme |
rtk.set_theme_by_bgcolor() | Initializes the UI theme appropriate for the given background color |
rtk.set_theme_overrides() | Applies custom overrides to the in-the-box theme settings |
rtk.new_theme() | Creates a custom rtk color theme |
rtk.add_modal() | Registers one or more widgets to be treated as modal |
rtk.is_modal() | Check if the given widget (or any widget at all) has been registered
as modal via |
rtk.reset_modal() | Removes all modal widget registrations, returning event routing to normal |
rtk.pushdest() | Push a destination image id onto the stack for off-screen drawing |
rtk.popdest() | Pops the last image destination off the stack |
rtk.onerror() | Callback invoked when any function called via |
rtk.call() | Immediately call a function with the given arguments with error handling |
rtk.defer() | Registers a function (with arguments) to be called back by REAPER |
rtk.callsoon() | Registers a function (with arguments) to be invoked within the next
|
rtk.callafter() | Calls a function (with arguments) after the specified duration |
rtk.quit() | Terminates the script, closing any open |
Set to true to enable touch scrolling, where scrolling rtk.Viewport
is possible
by click-dragging within them, which is suitable for touchscreen displays (default
false).
When this is enabled, certain interactions that normally occur immediately upon
mouse-down (such as opening the popup menu of an rtk.OptionMenu
) will be deferred
until touch_activate_delay
elapses, or in some cases until mouse up, giving the
user the opportunity to touch scroll.
Touch scrolling in rtk also supports kinetic scrolling.
If true, scrolling viewports with the mouse wheel or programmatically will
animate (default true). This affects the default for all viewports, but individual
viewports can override this with the rtk.Viewport.smoothscroll
attribute.
REAPER limits scripts to 25-30fps (Windows being around 30 while Linux and OS X are closer to 25), so it can only ever really get so "smooth" but it's a useful enough effect that it's enabled by default.
When touchscroll
is enabled, this is the default amount of time in seconds
that widgets will wait before responding to a "mouse down" event (which equates to
a touch event for touchscreen displays) (default 0.1 seconds). This can be overridden
per widget: see rtk.Widget.touch_activate_delay
for more.
Number of seconds the mouse is pressed over a widget before
rtk.Widget:onlongpress()
fires (default 0.5
)
Interval between successive clicks before rtk.Widget:ondoubleclick()
fires (default 0.5
)
Number of seconds where the mouse remains stationary over a widget before its
tooltip pops up (default 0.5
).
When the luminance of a color (as returned by rtk.color.luma())
is above this value then the color is considered "light" for purposes of picking
appropriately contrasting text and icon colors (default 0.6
)
Enables visual inspection of widget geometry by mousing over them (default false
).
When enabled, mousing over a widget will paint boxes indicating its calculated geometry and padding boundaries, and will display a tooltip showing those values. When multiple widgets are stacked atop each other, the widget with the highest z-index will win.
When log.level
is set to log.DEBUG
or lower, pressing F12 will toggle
this value if the rtk.Event.KEY
event is unhandled.
The last rtk.Window
object that was instantiated, or nil if none was
instantiated. If you need to access global refs but don't have
a reference to a widget available, you can use this field.
true if the JS_ReaScriptAPI extension is installed, false otherwise
true if the SWS extension is installed
The full path to the directory containing the script that the REAPER action invoked. The trailing path separator is always included.
hwnd of Reaper's main window
Monotonically increasing counter that is incremented each gfx update cycle as long
as an rtk.Window
is currently open
Frame rate (measured on each update cycle of the main window)
The hwnd of the currently focused window, or nil if js_ReaScriptAPI is not installed
The currently focused rtk.Widget
(or nil if no widget is focused)
A table holding the current theme colors which is initialized via rtk.set_theme()
.
See rtk.themes
for field details.
Creates a new class.
This function wraps middleclass
and includes a static class method register()
on the returned class for registering
attributes. The register()
function takes a table that describes the class's attributes,
where each field in the table is an instance of rtk.Attribute
.
All classes in rtk use this function, and therefore provide all the same capabilities as middleclass itself. Middleclass is bundled with rtk, but also includes some minor tweaks (e.g. to support finalizers for garbage collection).
For simple attributes that don't need any special behavior or treatment, the value
can be the attribute's default value, rather than an rtk.Attribute
.
Determine if a value is an instance or sublcass of a particular class.
assert(rtk.isa(obj, rtk.Image), 'must pass an rtk.Image to this function')
v | (any) | the value to test |
cls | (rtk.class) | a class object as returned by |
(boolean) | true if the value is an instance of cls (or a subclass thereof) |
Registers an image search path where images and icons can be found by
rtk.Image.icon()
or rtk.Image:load()
.
This should be called early in program execution, at least before any rtk objects are created that would depend on this path.
If a non-nil iconstyle is provided, this indicates that the given path contains either
light
icons (suitable for dark themes) or dark
icons (suitable for light themes).
When loading an icon image via rtk.Image.icon()
(which is often done automatically
when passing icon names to widget icon attributes, for example with rtk.Button.icon
),
paths registered for the appropriate iconstyle are searched first.
If an icon has been requested that's not found in any path for the required icon style but is found in a path for opposite icon style, then rtk will automatically recolor the icon monochromatically (to either white or black) to match the required icon style. This recoloring is only ever done for icons found in paths that were registered here with a non-nil icon style. Images found in paths with nil iconstyle will not be recolored.
If a non-absolute path is specified, then it will be relative to rtk.script_path
.
path | (string) | the fully qualified path within which to search for images |
iconstyle | (string or nil) | if specified, it's either |
Initializes the UI theme.
If this function isn't called, then either the light or the dark theme will automatically be selected based on the window's background color (which default to a color based on REAPER's current theme).
The theme cannot currently be changed dynamically after widgets have been instantiated. A restart of the script is necessary for theme changes to take effect.
name | (string) | The name of a theme added to |
overrides | (table or nil) | a table of fields that overrides those from the requested theme |
Initializes the UI theme appropriate for the given background color.
Similar to rtk.set_theme
but decides whether the dark
or light
theme should
be used given the background color, in combination with rtk.light_luma_threshold
.
It also overrides the theme's built-in background color to the given color.
color | (string or table) | the background color (format per |
overrides | (table or nil) | if specified, passed to |
Applies custom overrides to the in-the-box theme settings.
This function takes a table which can optionally contain light
or
dark
fields which in turn contain a table of overrides specific to
that theme. Any other fields in the table be applied to both themes.
Some widgets in rtk are luma-adaptive, meaning they automatically adjust certain colors based on the user-defined background. As a result, it may be desirable to customize both themes, even though your primary theme is one or the other.
rtk.set_theme_overrides({
-- Use solid-color button surfaces regardless of the theme.
button_gradient_mul = 0,
-- Apply lower contrast default text colors, which differ by theme
dark = {
text = '#bbbbbb'
},
light = {
text = '#666666'
}
})
overrides | (table) | a table of overrides that apply to all or specific themes |
Creates a custom rtk color theme.
After the theme has been created, you can set it via rtk.set_theme()
.
name | (string) | the name of the custom theme, where |
base | (string or nil) | the base theme from which to inherit default values (if set) |
overrides | (table) | the table of theme overrides according to the theme fields |
Registers one or more widgets to be treated as modal.
When at least one widget is registered as modal, the modal widgets will
exclusively receive events to the exclusion of all others. Non-modal widgets
will be rendered inert until rtk.reset_modal()
is called. If a container is
registered as modal then all its child descendants will also receive events.
This is used by rtk.Popup
, for example.
... | (rtk.Widget) | one or more widgets to mark as modal |
Check if the given widget (or any widget at all) has been registered
as modal via rtk.add_modal()
.
If the given widget is a child of a modal container, then this function will return.
widget | (rtk.Widget or nil) | a widget to check if modal, or nil to check if any widget is modal. |
(bool) | true if the widget is considered modal, false otherwise |
Removes all modal widget registrations, returning event routing to normal.
Push a destination image id onto the stack for off-screen drawing.
The target for graphics operations will be the supplied image id
until a new image is pushed or rtk.popdest()
is called.
This is a low level function and generally doesn't need to be called
directly by library users. And even then, if using an rtk.Image
,
rtk.Image:pushdest()
is recommended instead.
local img = rtk.Image()
rtk.pushdest(img.id)
dest | (int) | the buffer id to target for drawing |
Pops the last image destination off the stack.
When the stack is empty, the rtk.Window
will be the target for drawing.
Callback invoked when any function called via rtk.defer()
or rtk.call()
raises an error.
The default behavior logs the error (with stack trace) to the console and aborts program execution, but it can be replaced by user-custom error handling.
err | (string) | the error message |
traceback | (string) | a multiline stack trace capturing where the error occurred |
Immediately call a function with the given arguments with error handling.
Errors generated by the invoked function will cause rtk.onerror()
to
be called.
It is a good idea to invoke your script's entrypoint via rtk.call()
as early as
possible to ensure you get useful error messages during any initial script setup.
local rtk = require('rtk')
function main()
local window = rtk.Window()
window:add(rtk.Text{'Hello World'})
window:open()
end
rtk.call(main)
func | (function) | the function to invoke |
... | (any) | one or more arguments to pass to |
(any) | the value(s) returned by |
Registers a function (with arguments) to be called back by REAPER.
This wraps reaper.defer()
with the ability to pass arguments to the function (a minor
convenience to avoid an anonymous function in common cases) and, more importantly,
error handling by means of using rtk.call()
. Another difference with
reaper.defer()
is that any callbacks scheduled with rtk.defer()
will be ignored
when rtk.quit()
is called, whereas functions scheduled with reaper.defer()
will be
invoked.
It's generally recommended to prefer rtk.defer
() over REAPER's native
reaper.defer()
API in order to benefit from the improved ergonomics and error
handling.
func | (function) | the function to invoke |
... | (any) | one or more arguments to pass to |
Registers a function (with arguments) to be invoked within the next
rtk.Window
update.
This is similar to but subtly different than rtk.defer()
. rtk.defer()
asks REAPER
itself to schedule the function, which happens at the start of the next tick of the
REAPER script, and so there may be a slight delay (usually around 30ms). Meanwhile,
rtk.callsoon()
functions are invoked at select points witihn the rtk.Window
update loop.
One such point is just after event handlers have executed, but before any pending reflow or draw. This allows event handlers to schedule a function to be invoked after all other handlers have completed but can still update the UI without any delay.
If there is no rtk.Window
currently running then rtk.defer()
will be used as a fallback.
func | (function) | the function to invoke |
... | (any) | one or more arguments to pass to |
Calls a function (with arguments) after the specified duration.
duration | (number) | number of seconds to delay execution (can be fractional) |
func | (function) | the function to invoke |
... | (any) | one or more arguments to pass to |
Terminates the script, closing any open rtk.Window
.
Unlike rtk.Window:close()
which can keep the a script running provided there are
pending deferred calls, this function abandons any deferred calls and exits
immediately. Note that this only applies to deferred functions scheduled with
rtk.defer()
, rtk.callsoon()
, or rtk.callafter()
; any functions scheduled with
REAPER's native reaper.defer()
will be invoked.
If rtk.Window:open()
is called subsequently, it will act as a no-op.
Controls the overall scale of the interface.
The fields in the rtk.scale
table reflect the current scale values. The rtk.scale.user
field is how you can adjust the overall scale of the rtk.Window
.
rtk.scale.user¶ | number | read-write |
User-defined scale factor (default |
rtk.scale.system¶ | number | read-only |
Scale factor determined by the system. On Apple Retina displays, this value will
be |
rtk.scale.reaper¶ | number | read-only |
REAPER's custom scale modifier that is set via the "Advanced UI/system tweaks" button on the General settings page. This value is only read once on startup, so the script will need to be restarted if this preference is changed. |
rtk.scale.framebuffer¶ | number | read-only |
The scale factor of the internal graphics frame buffer relative to the OS window
geometry. On Windows and Linux this is always This is distinct from |
rtk.scale.value¶ | number | read-only |
The final calculated scale factor to which all UI elements scale themselves. This is
calculated as Note If you are implementing widgets or manually drawing, |
Holds the state of the current drag-and-drop operation (if any).
rtk.dnd.dragging | rtk.Widget or nil | read-only |
The currently dragging |
rtk.dnd.droppable | boolean | read-only |
true if the currently |
rtk.dnd.arg | any | read-only |
The user argument as returned by |
rtk.dnd.buttons | rtk.mouse | read-only |
A bitmap of mouse button constants (BUTTON_LEFT, BUTTON_MIDDLE, or BUTTON_RIGHT) that were pressed when the drag operation began |
The currently dragging rtk.Widget
(or nil if none), which is set when
the user drags a widget and that widget's rtk.Widget:ondragstart()
handler returns a value that approves the drag operation.
true if the currently dragging
widget is eligible to be dropped and false
otherwise. When false, it means ondrop*() handlers will never be called.
This is implicitly set based on the return value of the widget's
rtk.Widget:ondragstart()
handler. This is useful for drag-only
widgets such scrollbars that want to leverage the global drag-handling
logic without any need for droppability.
The user argument as returned by rtk.Widget:ondragstart()
for the currently
dragging
widget
A bitmap of mouse button constants (BUTTON_LEFT,
BUTTON_MIDDLE, or BUTTON_RIGHT)
that were pressed when the drag operation began. This mouse button(s) needs to
be released in order for rtk.Widget:ondragend()
to fire.
Although this table will include the current mouse coordinates and buttons
pressed, you're strongly encouraged to use the fields from rtk.Event
instead.
You can use these fields only when an event isn't available (although it almost
always is).
BUTTON_LEFT¶ | Left mouse button (used in |
BUTTON_MIDDLE¶ | Middle mouse button (used in |
BUTTON_RIGHT¶ | Right mouse button (used in |
x¶ | x coordinate of last mouse position, relative to gfx window. See also |
y¶ | y coordinate of last mouse position, relative to gfx window. See also |
down¶ | Bitmap of |
Constants that can be assigned to rtk.Widget.cursor
or passed to
rtk.Window:request_mouse_cursor()
.
Cursors marked as Windows only will fall back to the standard POINTER
on Mac and Linux.
-- Creates a button that shows the "invalid" mouse cursor when the mouse hovers over it.
local button = rtk.Button{label='Click at your peril', cursor=rtk.mouse.cursors.INVALID}
button.onclick = function(self, event)
button:attr('label', "I see you're a gambler")
button:attr('cursor', rtk.mouse.cursors.REAPER_TREBLE_CLEF)
end
container:add(button)
Versions of REAPER prior to 6.24rc3 had a bug where the cursor would not change until the mouse moves, and wouldn't change at all when the mouse button was pressed. If js_ReaScriptAPI is available, rtk will avoid this bug even on older versions of REAPER.
UNDEFINED¶ | Cursor is not defined, in which case the window will default to |
|
POINTER¶ | Standard pointer |
|
BEAM¶ | I-beam used for text fields |
|
LOADING¶ | Indicates the window is currently no responsive (Windows only) |
|
CROSSHAIR¶ | Used for precision pointing (Windows only) |
|
UP_ARROW¶ | An up arrow |
|
SIZE_NW_SE¶ | Resize cursor from north-west to south-east (width/height resize) |
|
SIZE_SW_NE¶ | Resize cursor from south-west to north-east (width/height resize) |
|
SIZE_EW¶ | Resize cursor from east to west (width-only resize) |
|
SIZE_NS¶ | Resize cursor from north to south (height-only resize) |
|
MOVE¶ | Move a window in any direction |
|
INVALID¶ | Indicates the mouse position is an invalid target |
|
HAND¶ | A hand pointer for hyperlink selection |
|
POINTER_LOADING¶ | Standard pointer with a loading icon (Windows only) |
|
POINTER_HELP¶ | Standard pointer with a question mark (Windows only) |
|
REAPER_FADEIN_CURVE¶ | Adjust fade-in curve at start of media item |
|
REAPER_FADEOUT_CURVE¶ | Adjust fade-out curve at start of media item |
|
REAPER_CROSSFADE¶ | Adjust fade-out and fade-in curves between two items |
|
REAPER_DRAGDROP_COPY¶ | Drag-and-drop-copy item |
|
REAPER_DRAGDROP_RIGHT¶ | Mouse pointer indicating dragging an item to the right |
|
REAPER_POINTER_ROUTING¶ | Standard mouse pointer with stereo audio plug beneath |
|
REAPER_POINTER_MOVE¶ | Standard mouse pointer with quad-arrow move icon |
|
REAPER_POINTER_MARQUEE_SELECT¶ | Standard mouse pointer with a dotted square indicating marquee select |
|
REAPER_POINTER_DELETE¶ | Standard mouse pointer with an X on the bottom right indicating a delete action |
|
REAPER_POINTER_LEFTRIGHT¶ | Standard mouse pointer with left/right arrows on the bottom right |
|
REAPER_POINTER_ARMED_ACTION¶ | Standard mouse pointer with the letter A along the bottom right |
|
REAPER_MARKER_HORIZ¶ | Diamond marker with arrows to the left and right |
|
REAPER_MARKER_VERT¶ | Diamond marker with arrows above and below |
|
REAPER_ADD_TAKE_MARKER¶ | Up/down arrows with a tuning fork (?) to the right |
|
REAPER_TREBLE_CLEF¶ | Treble clef with D major key signature |
|
REAPER_BORDER_LEFT¶ | Left/right arrow with a left edge indicator |
|
REAPER_BORDER_RIGHT¶ | Left/right arrow with a right edge indicator |
|
REAPER_BORDER_TOP¶ | Up/down arrow with a top edge indicator |
|
REAPER_BORDER_BOTTOM¶ | Up/down arrow with a bottom edge indicator |
|
REAPER_BORDER_LEFTRIGHT¶ | Left/right arrow indicating the middle point between two items |
|
REAPER_VERTICAL_LEFTRIGHT¶ | Left/right arrow centered on a vertical line |
|
REAPER_GRID_RIGHT¶ | Left/right arrow on right edge of a grid |
|
REAPER_GRID_LEFT¶ | Left/right arrow on left edge of a grid |
|
REAPER_HAND_SCROLL¶ | A gripped hand used for drag-moving |
|
REAPER_FIST_LEFT¶ | A right fist pointed right indicating pulling something to the left |
|
REAPER_FIST_RIGHT¶ | A left fist pointed left indicating pulling something to the right |
|
REAPER_FIST_BOTH¶ | Two fists overlapping and pulling in opposite directions |
|
REAPER_PENCIL¶ | Pencil pointing up and to the left |
|
REAPER_PENCIL_DRAW¶ | A pencil pointing down and to the left with a drawn squiggle below |
|
REAPER_ERASER¶ | An eraser pointing down and to the left |
|
REAPER_BRUSH¶ | A paint brush pointing down and to the left |
|
REAPER_ARP¶ | A few stacked piano roll notes with an arrow pointing right |
|
REAPER_CHORD¶ | A few adjacent piano roll notes with an arrow pointing up |
|
REAPER_TOUCHSEL¶ | Right hand with index finger pointing up with an outlined plus sign |
|
REAPER_SWEEP¶ | Two overlapping mouse pointers offset by a couple pixels in both directions |
|
REAPER_FADEIN_CURVE_ALT¶ | Upper left curved edge with arrows on either side pointing in opposite directions |
|
REAPER_FADEOUT_CURVE_ALT¶ | Upper right curved edge with arrows on either side pointing in opposite directions |
|
REAPER_XFADE_WIDTH¶ | Two overlapping curves with a left/right arrow below |
|
REAPER_XFADE_CURVE¶ | Two overlapping curves with separate left and right arrows on either side |
|
REAPER_EXTMIX_SECTION_RESIZE¶ | Up and down arrows with a small crosshair in the middle |
|
REAPER_EXTMIX_MULTI_RESIZE¶ | Up and down arrows with bottom border in the middle and a plus sign on the top right |
|
REAPER_EXTMIX_MULTISECTION_RESIZE¶ |
|
|
REAPER_EXTMIX_RESIZE¶ |
|
|
REAPER_EXTMIX_ALLSECTION_RESIZE¶ |
|
|
REAPER_EXTMIX_ALL_RESIZE¶ |
|
|
REAPER_ZOOM¶ | A magnifying glass |
|
REAPER_INSERT_ROW¶ | Narrow, more steeply angled mouse pointer pointing to the left |
|
REAPER_RAZOR¶ | Razor blade (Reaper 6.24+) |
|
REAPER_RAZOR_MOVE¶ | Razor blade with quad-arrow move icon (Reaper 6.24+) |
|
REAPER_RAZOR_ADD¶ | Razor blade with an outlined plus sign (Reaper 6.24+) |
|
REAPER_RAZOR_ENVELOPE_VERTICAL¶ | Up/down arrow with vertically oriented brace brackets (Reaper 6.29+) |
|
REAPER_RAZOR_ENVELOPE_RIGHT_TILT¶ | Up/down arrow with ramp to right side (Reaper 6.29+) |
|
REAPER_RAZOR_ENVELOPE_LEFT_TILT¶ | Up/down arrow with ramp to left side (Reaper 6.29+) |
Font constants and settings to be used across the UI.
The constants (i.e. those fields in uppercase) can be used with the fontflags
attributes available on certain widgets (such as rtk.Text.fontflags
), which takes
a bitmap of these constants:
local t1 = rtk.Text{'just bold', fontflags=rtk.font.BOLD}
local t2 = rtk.Text{'bold and italicized', fontflags=rtk.font.BOLD|rtk.font.ITALICS}
Numeric keycode constants used with rtk.Event.keycode
.
UP¶ | Up arrow key |
DOWN¶ | Down arrow key |
LEFT¶ | Left arrow key |
RIGHT¶ | Right arrow key |
RETURN¶ | Enter key (alias for |
ENTER¶ | Enter key (alias for |
SPACE¶ | Space bar |
BACKSPACE¶ | Backspace key |
ESCAPE¶ | Escape key |
TAB¶ | Tab key |
HOME¶ | Home key |
END¶ | End key |
INSERT¶ | Insert key |
DELETE¶ | Delete key |
F1¶ | F1 function key |
F2¶ | F2 function key |
F3¶ | F3 function key |
F4¶ | F4 function key |
F5¶ | F5 function key |
F6¶ | F6 function key |
F7¶ | F7 function key |
F8¶ | F8 function key |
F9¶ | F9 function key |
F10¶ | F10 function key |
F11¶ | F11 function key |
F12¶ | F12 function key |
A table of color/font themes used for rtk UIs, keyed on theme name. There are two themes out of the box:
You can add your own custom themes to this table and reference it by name in
rtk.set_theme()
.
All colors must be specified in one of the supported color formats. These
colors define defaults for various widgets, but colors can always be overridden on
specific widget instances. All font values are in the form {font face name, font size}
or nil to use default_font
.
Custom values need to be set before widgets are instantiated: changing afterward doesn't dynamically update existing widgets.
Each theme table registered under rtk.themes
contains the following fields:
dark¶ | boolean | true if the theme is dark (true here implies |
light¶ | boolean | true if the theme is light (true here implies |
bg¶ | colortype | overall background color for the window over top all widgets are drawn
and is the default color used by |
default_font¶ | table | global default font (default is |
accent¶ | colortype | accent color used for things like mouseover highlights and selections |
accent_subtle¶ | colortype | used in areas where a more subdued accent color is needed |
tooltip_bg¶ | colortype | background color of the tooltip (default is white) |
tooltip_text¶ | colortype | color of the tooltip text and border (default is black) |
tooltip_font¶ | table | font used for tooltips (default is |
text¶ | colortype | text color for text in widgets such as |
text_faded¶ | colortype | a more subdued text color useful for less obtrusive text, which can be used for example with a status bar |
text_font¶ | table | default font used for |
button¶ | colortype | the default color for |
heading¶ | colortype | the default color for |
heading_font¶ | table | default font used for |
button_label¶ | colortype | color of text in |
button_font¶ | table | default font used for |
button_gradient_mul¶ | number | a multiplier that is applied to each of |
button_tag_alpha¶ | number | Opacity of the black overlay for tagged buttons (default 0.32). |
button_normal_gradient¶ | number | the degree of gradient in normal button surfaces (i.e. not hovering or clicked) from -1 to 1, where negative values get darker toward the bottom of the surface, and positive values get lighter. Use 0 to disable the gradient and use a single surface color. |
button_normal_border_mul¶ | number | multiplier appied to each color channel for the border of a button in its normal state |
button_hover_gradient¶ | number | like |
button_hover_brightness¶ | number | a multiplier to the value channel (in HSV colorspace) of the button color when the mouse hovers over it |
button_hover_mul¶ | number | multiplier applied to each color channel of the button's surface when the mouse hovers over it |
button_hover_border_mul¶ | number | like |
button_clicked_gradient¶ | number | like |
button_clicked_brightness¶ | number | like |
button_clicked_mul¶ | number | like |
button_clicked_border_mul¶ | number | like |
entry_font¶ | table | Default font used for |
entry_bg¶ | colortype | the background color for |
entry_placeholder¶ | colortype | the faded color for the optional placeholder of empty |
entry_border_hover¶ | colortype | color of |
entry_border_focused¶ | colortype | color of |
entry_selection_bg¶ | colortype | background color of selected text in an |
popup_bg¶ | colortype or nil | background color of |
popup_overlay¶ | colortype or nil | default overlay of the window when |
popup_bg_brightness¶ | number | a multiplier to the value channel (in HSV colorspace) of the window background
( |
popup_shadow¶ | colortype | the color of the shadow for |
popup_border¶ | colortype | the border color of |
slider¶ | colortype | color of |
slider_track¶ | colortype | color of |
slider_font¶ | table | font and size used for |
slider_tick_label¶ | colortype | color used for |
Information about the currently loaded rtk version.
If you're interested in checking REAPER's version rather than rtk's, see
rtk.check_reaper_version()
rtk.version.string¶ | string | read-only |
The stringified version of this rtk package, e.g. |
rtk.version.api¶ | number | read-only |
The API version number. If the rtk version is |
rtk.version.major¶ | number | read-only |
The major version number. This is identical to |
rtk.version.minor¶ | number | read-only |
The minor version number. If the rtk version is |
rtk.version.patch¶ | number | read-only |
The patch version number. If the rtk version is |
rtk.version.check() | Checks the current rtk version against the given version component numbers |
Checks the current rtk version against the given version component numbers.
if rtk.version.check(1, 2) then
return reaper.MB('rtk version 1.2 is required', 'Version too old', 0)
end
major | (number) | require at least this major (i.e. API) version |
minor | (number or nil) | require at least this minor version, provided the major version is satisfied. If nil, minor version is not checked and patch must also be nil. |
patch | (number or nil) | require at least this patch level, provided both major and minor versions are satisfied. If nil, patch level is not checked. |
(bool) | true if the current rtk version is at least as new as the given version |