chore: initial studio-theme-sunset 0.1.0
Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
commit
60ded246ee
9 changed files with 195 additions and 0 deletions
91
src/lib.rs
Normal file
91
src/lib.rs
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
//! `studio.theme.sunset` — warm dusk Studio theme.
|
||||
//!
|
||||
//! Pink / orange / violet gradient feel. Reads like the sky
|
||||
//! 20 minutes after sunset: still bright at the horizon,
|
||||
//! purple settling in above. Light mode keeps a warm-white
|
||||
//! surface; dark mode drops into a deep mulberry navy.
|
||||
|
||||
#![allow(clippy::result_large_err)]
|
||||
|
||||
use fai_plugin_sdk::{bindings, export_plugin};
|
||||
|
||||
type ColorScheme = bindings::fai::studio_plugin::plugin_types::ColorScheme;
|
||||
type PluginError = bindings::fai::studio_plugin::plugin_types::PluginError;
|
||||
type RenderedOutput = bindings::fai::studio_plugin::plugin_types::RenderedOutput;
|
||||
|
||||
const SUNSET_LIGHT: [u32; 14] = [
|
||||
0xFFE91E63, // primary — pink 500
|
||||
0xFFFFFFFF, // on_primary
|
||||
0xFFFF7043, // secondary — deep orange 400
|
||||
0xFFFFFFFF, // on_secondary
|
||||
0xFF8E24AA, // tertiary — purple 600
|
||||
0xFFFFFFFF, // on_tertiary
|
||||
0xFFC62828, // error
|
||||
0xFFFFFFFF, // on_error
|
||||
0xFFFFF5F0, // surface — warm whitespace
|
||||
0xFF38121F, // on_surface
|
||||
0xFFFFDDD0, // surface_variant
|
||||
0xFF804040, // on_surface_variant
|
||||
0xFFC97070, // outline
|
||||
0xFFE6BFB5, // outline_variant
|
||||
];
|
||||
|
||||
const SUNSET_DARK: [u32; 14] = [
|
||||
0xFFF48FB1, // primary — pink 200
|
||||
0xFF38121F, // on_primary
|
||||
0xFFFFAB91, // secondary — deep orange 200
|
||||
0xFF381200, // on_secondary
|
||||
0xFFCE93D8, // tertiary — purple 200
|
||||
0xFF38003A, // on_tertiary
|
||||
0xFFEF5350, // error
|
||||
0xFF1A0000, // on_error
|
||||
0xFF2A0F1F, // surface — dark sunset
|
||||
0xFFFFD6E0, // on_surface
|
||||
0xFF4A2030, // surface_variant
|
||||
0xFFE6BFB5, // on_surface_variant
|
||||
0xFF806060, // outline
|
||||
0xFF4A2D38, // outline_variant
|
||||
];
|
||||
|
||||
struct SunsetPlugin;
|
||||
|
||||
impl bindings::exports::fai::studio_plugin::theme::Guest for SunsetPlugin {
|
||||
fn theme_for(brightness: String) -> Result<ColorScheme, PluginError> {
|
||||
let tokens = match brightness.as_str() {
|
||||
"light" => SUNSET_LIGHT.to_vec(),
|
||||
"dark" => SUNSET_DARK.to_vec(),
|
||||
other => {
|
||||
return Err(PluginError::Declined(format!(
|
||||
"sunset has no scheme for brightness '{other}' \
|
||||
(supported: light, dark)"
|
||||
)));
|
||||
}
|
||||
};
|
||||
Ok(ColorScheme { brightness, tokens })
|
||||
}
|
||||
}
|
||||
|
||||
impl bindings::exports::fai::studio_plugin::translate::Guest for SunsetPlugin {
|
||||
fn translate(
|
||||
_text: String,
|
||||
_from_locale: String,
|
||||
_to_locale: String,
|
||||
) -> Result<String, PluginError> {
|
||||
Err(PluginError::Declined(
|
||||
"sunset is a theme plugin and does not translate".to_string(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl bindings::exports::fai::studio_plugin::output_view::Guest for SunsetPlugin {
|
||||
fn render(
|
||||
_mime_type: String,
|
||||
_data: Vec<u8>,
|
||||
) -> Result<RenderedOutput, PluginError> {
|
||||
Err(PluginError::Declined(
|
||||
"sunset is a theme plugin and does not render outputs".to_string(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
export_plugin!(SunsetPlugin);
|
||||
Loading…
Add table
Add a link
Reference in a new issue