widget.colorpicker
local colorpicker = require "widget.colorpicker"
NEWLINE
(field) NEWLINE: integer
Indicates on a widget.styledtext that a new line follows.
__index
(field) __index: core.object
alpha
(field) alpha: number
animations
(field) animations: widget.animation[]
background_color
(field) background_color: renderer.color
Array of bytes that represents a color used by the rendering functions.
border
(field) border: widget.border
Represents the border of a widget.
brightness_color
(field) brightness_color: renderer.color
Array of bytes that represents a color used by the rendering functions.
brightness_mouse_down
(field) brightness_mouse_down: boolean
brightness_pos
(field) brightness_pos: number
captured_widget
(field) captured_widget: widget
Widget that captured mouse events
child_active
(field) child_active: widget|nil
A base widget
childs
(field) childs: table<integer, widget>
clickable
(field) clickable: boolean
context
(field) context: 'application'|'session'
current_scale
(field) current_scale: number
cursor
(field) cursor: 'arrow'|'hand'|'ibeam'|'sizeh'|'sizev'
defer_draw
(field) defer_draw: boolean
draggable
(field) draggable: boolean
dragged
(field) dragged: boolean
explicit_update
(field) explicit_update: boolean
font
(field) font: string|renderer.font|widget.fontreference
Represents a reference to a font stored elsewhere.
force_events
(field) force_events: table
foreground_color
(field) foreground_color: renderer.color
Array of bytes that represents a color used by the rendering functions.
h_scrollbar
(field) h_scrollbar: widget.scrollbar
has_focus
(field) has_focus: boolean
hovered_scrollbar
(field) hovered_scrollbar: boolean
html_notation
(field) html_notation: widget.textbox
html_updating
(field) html_updating: boolean
hue_color
(field) hue_color: renderer.color
Array of bytes that represents a color used by the rendering functions.
hue_mouse_down
(field) hue_mouse_down: boolean
hue_pos
(field) hue_pos: number
input_text
(field) input_text: boolean
is_scrolling
(field) is_scrolling: boolean
label
(field) label: string|table<integer, string|integer|renderer.color|renderer.font|widget.fontreference>
mouse
(field) mouse: widget.position
Represents the position of a widget.
mouse_is_hovering
(field) mouse_is_hovering: boolean
mouse_is_pressed
(field) mouse_is_pressed: boolean
mouse_pressed_outside
(field) mouse_pressed_outside: boolean
name
(field) name: string
next_zindex
(field) next_zindex: integer
parent
(field) parent: widget|nil
A base widget
perform_update_size_position
(field) perform_update_size_position: boolean
position
(field) position: widget.position
Represents the position of a widget.
prev_height
(field) prev_height: number?
prev_size
(field) prev_size: widget.position
Represents the position of a widget.
prev_view
(field) prev_view: unknown
prev_width
(field) prev_width: number?
render_background
(field) render_background: boolean
rgba_notation
(field) rgba_notation: widget.textbox
rgba_updating
(field) rgba_updating: boolean
saturation_color
(field) saturation_color: renderer.color
Array of bytes that represents a color used by the rendering functions.
saturation_mouse_down
(field) saturation_mouse_down: boolean
saturation_pos
(field) saturation_pos: number
scroll
(field) scroll: core.view.scroll
scrollable
(field) scrollable: boolean
selector
(field) selector: table
set_focus
(field) set_focus: any
size
(field) size: widget.position
Modifying this property directly is not advised, use set_size() instead.
skip_scroll_ctrl
(field) skip_scroll_ctrl: boolean
By default is set to true to allow ctrl+wheel or cmd+wheel on mac to scale the interface, you can set it to false on your parent widget to allow manually intercepting ctrl+wheel.
super
(field) super: widget
A base widget
textview
(field) textview: widget
A base widget
tooltip
(field) tooltip: (string|table<integer, string|integer|renderer.color|renderer.font|widget.fontreference>)?
tooltip_command
(field) tooltip_command: string?
type_name
(field) type_name: string
v_scrollbar
(field) v_scrollbar: widget.scrollbar
visible
(field) visible: boolean
zindex
(field) zindex: integer
color_from_string
function widget.colorpicker.color_from_string(color: string)
-> color: (renderer.color)?
Converts a css format color string into a renderer.color if possible, if conversion fails returns nil. Adapted from colorpreview plugin.
color_in_between
function widget.colorpicker.color_in_between(from_color: renderer.color, to_color: renderer.color, percent: number)
-> color: renderer.color
Gets a color between two given colors on the position defined by the given percent.
hsl_to_rgb
function widget.colorpicker.hsl_to_rgb(h: number, s: number, l: number, a: number)
-> rgba: renderer.color
Converts an HSL color value to RGB. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. Assumes h, s, and l are contained in the set [0, 1] and returns r, g, and b in the set [0, 255].
@param h
— The hue
@param s
— The saturation
@param l
— The lightness
@param a
— The alpha
hsv_to_rgb
function widget.colorpicker.hsv_to_rgb(h: number, s: number, v: number, a: number)
-> rgba: renderer.color
Converts an HSV color value to RGB. Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes h, s, and v are contained in the set [0, 1] and returns r, g, and b in the set [0, 255].
@param h
— The hue
@param s
— The saturation
@param v
— The brightness
@param a
— The alpha
@return rgba
— The RGB representation
override_rootview
function widget.override_rootview()
Called when initializing a floating widget to generate RootView overrides, this function will only override the events once.
rgb_to_hsl
function widget.colorpicker.rgb_to_hsl(rgba: renderer.color)
-> hsla: table
Converts an RGB color value to HSL. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and l in the set [0, 1].
rgb_to_hsv
function widget.colorpicker.rgb_to_hsv(rgba: renderer.color)
-> hsva: table
Converts an RGB color value to HSV. Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and v in the set [0, 1].
@return hsva
— The HSV representation
__call
(method) core.object:__call(...any)
-> core.object
Metamethod to allow using the object call as a constructor.
__tostring
(method) widget:__tostring()
-> string
Useful for debugging.
activate
(method) widget:activate()
Emitted to input_text widgets when clicked.
add_child
(method) widget:add_child(child: widget)
Add a child widget, automatically assign a zindex if non set and sorts them in reverse order for better events matching.
animate
(method) widget:animate(target?: table, properties: table<string, number>, options?: widget.animation.options)
Registers a new animation to be ran on the update cycle.
@param target
— If nil assumes properties belong to widget it self.
capture_mouse
(method) widget:capture_mouse(scrolling?: boolean)
All mouse events will be directly sent to the widget even if mouse moves outside the widget region.
@param scrolling
— Capture for scrolling
centered
(method) widget:centered()
Center the widget horizontally and vertically to the screen or parent widget.
clamp_scroll_position
(method) core.view:clamp_scroll_position()
deactivate
(method) widget:deactivate()
Emitted to input_text widgets on lost focus.
destroy
(method) widget:destroy()
If floating, remove the widget from the floating widgets list to allow proper garbage collection.
destroy_childs
(method) widget:destroy_childs()
Recursively destroy all childs from the widget.
drag
(method) widget:drag(x: number, y: number)
Used internally when dragging is activated.
draw
(method) widget.colorpicker:draw()
-> boolean
draw_background
(method) core.view:draw_background(color: renderer.color)
draw_border
(method) widget:draw_border(x?: number, y?: number, w?: number, h?: number)
Draw the widget configured border or custom one.
draw_brightness
(method) widget.colorpicker:draw_brightness(x: number, y: number, w: number, h: number)
Draw a brightness color bar at given location and size.
draw_hue
(method) widget.colorpicker:draw_hue(x: number, y: number, w: number, h: number)
Draw a hue color bar at given location and size.
draw_saturation
(method) widget.colorpicker:draw_saturation(x: number, y: number, w: number, h: number)
Draw a saturation color bar at given location and size.
draw_scrollbar
(method) widget:draw_scrollbar()
draw_selector
(method) widget.colorpicker:draw_selector(x: any, y: any, h: any, color: any)
draw_styled_text
(method) widget:draw_styled_text(text: table<integer, string|integer|renderer.color|renderer.font|widget.fontreference>, x: integer, y: integer, only_calc?: boolean, start_idx?: integer, end_idx?: integer)
-> width: integer
2. height: integer
Render or calculate the size of the specified range of elements in a styled text elemet.
draw_text_multiline
(method) widget:draw_text_multiline(font: string|renderer.font|widget.fontreference, text: string, x: integer, y: integer, color: renderer.color, only_calc: boolean)
-> resx: integer
2. resy: integer
3. width: integer
4. height: integer
Taken from the logview and modified it a tiny bit. TODO: something similar should be on pragtical core.
extend
(method) core.object:extend()
-> core.object
extends
(method) core.object:extends(T: any)
-> boolean
Check if the object inherits from the given type.
force_event
(method) widget:force_event(name: "mouse_released", force: boolean)
Toggle the forced interception of given event even if all the conditions for emitting it are not met.
Note: only "mouse_released" is implemented for the moment on floating views for use in the SelectBox, maybe a better system can be implemented on the future.
@param force
— If omitted is set to true by default
name:
| "mouse_released"
get_bottom
(method) widget:get_bottom()
-> number
Get the bottom y coordinate relative to parent
get_brightness_color
(method) widget.colorpicker:get_brightness_color()
-> renderer.color
Gets the currently selected color on the brightness bar.
get_color
(method) widget.colorpicker:get_color()
-> renderer.color
Gets the currently selected rgba color.
get_content_bounds
(method) core.view:get_content_bounds()
-> number
2. number
3. number
4. number
get_content_offset
(method) core.view:get_content_offset()
-> x: number
2. y: number
get_font
(method) widget:get_font(font?: string|renderer.font|widget.fontreference)
-> renderer.font
Get the real renderer.font associated with a widget.font.