Luce packages
LuceLuce BaseLuciaOS

dymokomi/luced-photo

Source of release 0.1.1

0.1.1 / src / theme.luc

## luced-photo's palette: luced-2d's greys and #E7A03F orange in the same linear-light
## color space, kept local so the shared UI package stays neutral.
from luce_ui.ui import Theme
from luce_gpu.gpu import Color
from luce_color import transfer

## A grey from an sRGB byte value.
pub func grey(byte: float) -> Color:
    let value = transfer.srgb_decode(byte / 255.0)
    return Color(value, value, value)

## A color from sRGB byte values.
pub func srgb(red: float, green: float, blue: float) -> Color:
    return Color(transfer.srgb_decode(red / 255.0), transfer.srgb_decode(green / 255.0), transfer.srgb_decode(blue / 255.0))

pub func accent() -> Color:
    return srgb(231.0, 160.0, 63.0)

## Where no photo is: darker than any pane, so pictures stand out.
pub func viewer_backdrop() -> Color:
    return grey(30.0)

pub func backdrop() -> Color:
    return grey(26.0)
pub func tab_strip() -> Color:
    return grey(38.0)
pub func surface() -> Color:
    return grey(50.0)
pub func surface_raised() -> Color:
    return grey(46.0)
pub func border() -> Color:
    return grey(58.0)
pub func text() -> Color:
    return grey(217.0)
pub func text_muted() -> Color:
    return grey(140.0)

## The window's theme, its accent `tint` (the mode's color; luced-2d's orange
## by default).
pub func editor_theme(wanted: Color? = none) -> Theme!:
    let tint = wanted else accent()
    var theme = Theme()
    theme.background = backdrop()
    theme.panel = surface()
    theme.gutter = tab_strip()
    theme.foreground = text()
    theme.muted = text_muted()
    theme.selection = tint
    theme.accent = tint
    theme.button = grey(41.0)
    theme.button_hover = grey(58.0)
    theme.pressed = grey(72.0)
    theme.menu = surface_raised()
    theme.menu_hover = grey(64.0)
    theme.strip = tab_strip()
    theme.sunken = grey(41.0)
    theme.raised = surface_raised()
    theme.accent_text = grey(0.0)
    theme.menu_selection = tint
    theme.border = border()
    theme.active_border = grey(150.0)
    theme.shadow_offset = 0.0
    theme.shadow_opacity = 0.0
    theme.control_radius = 5.0
    return theme