Icons
At a glance
Section titled “At a glance”Icon :: struct {...}icon :: proc(ic: Icon, style := TextStyle.Body, tone := Tone.Default)icon_empty :: proc(ic: Icon) -> boolicon_pixels :: proc(width, height: int, pixels: []Pixel) -> Iconload_icon :: proc(path: string) -> (Icon, bool)ICON_CALENDAR :: Icon{...}ICON_CHECK :: Icon{...}ICON_CHEVRON_DOWN :: Icon{...}ICON_CHEVRON_LEFT :: Icon{...}ICON_CHEVRON_RIGHT :: Icon{...}ICON_CHEVRON_UP :: Icon{...}ICON_CLOSE :: Icon{...}ICON_EYE :: Icon{...}ICON_EYE_OFF :: Icon{...}ICON_MENU :: Icon{...}ICON_MINUS :: Icon{...}ICON_MORE :: Icon{...}ICON_PLUS :: Icon{...}ICON_SEARCH :: Icon{...}ICON_STAR :: Icon{...}Icon :: struct { svg: string, // an SVG document, e.g. `#load("icons/menu.svg", string)` glyph: string, // or a character of the font, e.g. "★" image: Image, // or an image, scaled to the icon height tint: bool, // draw `image` in the text color (single-color images; `load_icon` decides)}An icon. Set one of the fields; the zero value is “no icon”. Icons are plain values, so they
can be constants and live in tables (NavItem, TreeNode).
| Field | Type | Notes |
|---|---|---|
svg | string | an SVG document, e.g. #load("icons/menu.svg", string) |
glyph | string | or a character of the font, e.g. ”★” |
image | Image | or an image, scaled to the icon height |
tint | bool | draw image in the text color (single-color images; load_icon decides) |
Source: kiln/icon.odin:24
Procedures
Section titled “Procedures”icon :: proc(ic: Icon, style := TextStyle.Body, tone := Tone.Default)An icon at the size of text in style, in the color of tone (if it has a single color).
kiln.icon(kiln.ICON_STAR, .Title, .Warning)| Argument | Type | Default |
|---|---|---|
ic | Icon | required |
style | TextStyle | TextStyle.Body |
tone | Tone | Tone.Default |
Source: kiln/icon.odin:86
icon_empty
Section titled “icon_empty”icon_empty :: proc(ic: Icon) -> boolTrue for the zero Icon.
| Argument | Type | Default |
|---|---|---|
ic | Icon | required |
| Returns | Type |
|---|---|
| #0 | bool |
Source: kiln/icon.odin:133
icon_pixels
Section titled “icon_pixels”icon_pixels :: proc(width, height: int, pixels: []Pixel) -> IconAn icon from RGBA pixels (row by row, top to bottom), with the same color rule as load_icon.
| Argument | Type | Default |
|---|---|---|
width | int | required |
height | int | required |
pixels | []Pixel | required |
| Returns | Type |
|---|---|
| #0 | Icon |
Source: kiln/icon.odin:110
load_icon
Section titled “load_icon”load_icon :: proc(path: string) -> (Icon, bool)Loads an icon from a file: an SVG, or an image (PNG, JPG, …). Images with a single color
(e.g. black on transparent) are tinted like text, colorful ones are drawn as they are. Call it
after the window opened (in init); the icon lives until the app ends.
| Argument | Type | Default |
|---|---|---|
path | string | required |
| Returns | Type |
|---|---|
| #0 | Icon |
| #1 | bool |
Source: kiln/icon.odin:98
Constants
Section titled “Constants”ICON_CALENDAR
Section titled “ICON_CALENDAR”ICON_CALENDAR :: Icon{...}Source: kiln/icon.odin:70
ICON_CHECK
Section titled “ICON_CHECK”ICON_CHECK :: Icon{...}Source: kiln/icon.odin:37
ICON_CHEVRON_DOWN
Section titled “ICON_CHEVRON_DOWN”ICON_CHEVRON_DOWN :: Icon{...}Source: kiln/icon.odin:43
ICON_CHEVRON_LEFT
Section titled “ICON_CHEVRON_LEFT”ICON_CHEVRON_LEFT :: Icon{...}Source: kiln/icon.odin:49
ICON_CHEVRON_RIGHT
Section titled “ICON_CHEVRON_RIGHT”ICON_CHEVRON_RIGHT :: Icon{...}Source: kiln/icon.odin:52
ICON_CHEVRON_UP
Section titled “ICON_CHEVRON_UP”ICON_CHEVRON_UP :: Icon{...}Source: kiln/icon.odin:46
ICON_CLOSE
Section titled “ICON_CLOSE”ICON_CLOSE :: Icon{...}Source: kiln/icon.odin:40
ICON_EYE
Section titled “ICON_EYE”ICON_EYE :: Icon{...}Source: kiln/icon.odin:73
ICON_EYE_OFF
Section titled “ICON_EYE_OFF”ICON_EYE_OFF :: Icon{...}Source: kiln/icon.odin:76
ICON_MENU
Section titled “ICON_MENU”ICON_MENU :: Icon{...}Source: kiln/icon.odin:55
ICON_MINUS
Section titled “ICON_MINUS”ICON_MINUS :: Icon{...}Source: kiln/icon.odin:64
ICON_MORE
Section titled “ICON_MORE”ICON_MORE :: Icon{...}Source: kiln/icon.odin:58
ICON_PLUS
Section titled “ICON_PLUS”ICON_PLUS :: Icon{...}Source: kiln/icon.odin:61
ICON_SEARCH
Section titled “ICON_SEARCH”ICON_SEARCH :: Icon{...}Source: kiln/icon.odin:67
ICON_STAR
Section titled “ICON_STAR”ICON_STAR :: Icon{...}Source: kiln/icon.odin:79