commit 7212a58ba5fe002617f2377a3171b928eb4b9f52 Author: flemming-it Date: Tue Jun 2 01:35:53 2026 +0200 chore: initial studio-theme-accessibility 0.1.0 Signed-off-by: flemming-it diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c96eb1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target/ +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..9cc9c87 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,32 @@ +# Standalone Cargo.toml — targets wasm32-wasip2. +# +# Build: +# cargo build --release --target wasm32-wasip2 +# +# Output: target/wasm32-wasip2/release/studio_theme_accessibility.wasm + +[package] +name = "studio_theme_accessibility" +version = "0.1.0" +edition = "2021" +authors = ["Dr. Stefan Flemming "] +license = "Apache-2.0" +publish = false +description = "F∆I Studio plugin — WCAG AA high-contrast Studio theme." +repository = "https://git.flemming.ai/fai-plugins/studio-theme-accessibility" +rust-version = "1.85" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +fai-plugin-sdk = { path = "../../fai_plugin_sdk_rust" } + +[package.metadata.component] +package = "fai:studio-plugin" + +[profile.release] +opt-level = "s" +lto = true +codegen-units = 1 +strip = true diff --git a/MODULE.de.md b/MODULE.de.md new file mode 100644 index 0000000..dc2f84c --- /dev/null +++ b/MODULE.de.md @@ -0,0 +1,8 @@ +# accessibility + +Barrierefreies WCAG-AA-Theme mit starkem Kontrast. + +Eines der mit F∆I Studio gelieferten Theme-Plugins. Nach +Installation erscheint es unter **Einstellungen → Themes** +neben den eingebauten Hell- und Dunkel-Themes. Auswahl +schaltet die gesamte Studio-Oberfläche um — ohne Neustart. diff --git a/MODULE.md b/MODULE.md new file mode 100644 index 0000000..255dfe1 --- /dev/null +++ b/MODULE.md @@ -0,0 +1,20 @@ +# accessibility + +WCAG AA high-contrast Studio theme. + +This is one of F∆I Studio's bundled theme plugins. When +installed, it appears in **Settings → Themes** alongside the +built-in light and dark themes. Select it and the entire +Studio UI re-themes immediately — no restart required. + +## When to pick this theme + +- Operators with low vision or colour-vision deficiency +- Bright-sunlight outdoor / kiosk deployments +- Any deployment where the public sector's accessibility + rules demand a verified high-contrast option + +Every foreground/background pair meets WCAG 2.2 AA +(≥ 4.5:1 for normal text); on-surface pairs hit AAA. Pure +black + pure white surfaces; deep-navy or sky-blue +primary depending on brightness. diff --git a/README.md b/README.md new file mode 100644 index 0000000..55c094f --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# studio-theme-accessibility + +WCAG AA high-contrast Studio theme. + +Ships a Material 3 ColorScheme pair (light + dark) through +the WIT `theme` export. Studio loads it as a +`studio.theme.accessibility` capability and switches the app's +ColorScheme when the operator picks it from the themes +picker. + +## Build + +```bash +cargo build --release --target wasm32-wasip2 +``` + +Output: `target/wasm32-wasip2/release/studio_theme_accessibility.wasm`. + +## Palette + +See `src/lib.rs` for the 14 ARGB tokens per brightness, in +Material 3 order (primary → on_primary → … → outline_variant). diff --git a/module.wasm b/module.wasm new file mode 100644 index 0000000..c5f8de7 Binary files /dev/null and b/module.wasm differ diff --git a/module.yaml b/module.yaml new file mode 100644 index 0000000..3ab583f --- /dev/null +++ b/module.yaml @@ -0,0 +1,17 @@ +schema_version: 3 +provider: fai +name: studio-theme-accessibility +version: 0.1.0 + +provides: + - capability: studio.theme.accessibility + version: 0.1.0 + +inputs: {} +outputs: {} + +permissions: [] + +studio_extension: + hooks: + - theme diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..32add0c --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.86" +targets = ["wasm32-wasip2"] +components = ["rustfmt", "clippy"] diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..0227092 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,94 @@ +//! `studio.theme.accessibility` — WCAG AA high-contrast theme. +//! +//! Optimised for low-vision operators + bright-sunlight +//! environments. Light mode: pure white surface, pure black +//! text, deep-navy primary (8.6:1 on white). Dark mode: pure +//! black surface, pure white text, light-blue primary +//! (≥7:1). Every foreground/background pair meets WCAG 2.2 AA +//! (≥4.5:1 for normal text); the on-surface pairs hit AAA. + +#![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 ACCESSIBILITY_LIGHT: [u32; 14] = [ + 0xFF003366, // primary — navy (8.6:1 on white) + 0xFFFFFFFF, // on_primary + 0xFF006400, // secondary — dark green + 0xFFFFFFFF, // on_secondary + 0xFF663300, // tertiary — dark amber + 0xFFFFFFFF, // on_tertiary + 0xFF990000, // error — deep red + 0xFFFFFFFF, // on_error + 0xFFFFFFFF, // surface — pure white + 0xFF000000, // on_surface — pure black + 0xFFF0F0F0, // surface_variant + 0xFF1A1A1A, // on_surface_variant + 0xFF000000, // outline + 0xFF4D4D4D, // outline_variant +]; + +const ACCESSIBILITY_DARK: [u32; 14] = [ + 0xFF66B3FF, // primary — light blue (≥7:1 on black) + 0xFF000000, // on_primary + 0xFF99FF99, // secondary + 0xFF000000, // on_secondary + 0xFFFFCC66, // tertiary + 0xFF000000, // on_tertiary + 0xFFFF6666, // error + 0xFF000000, // on_error + 0xFF000000, // surface — pure black + 0xFFFFFFFF, // on_surface — pure white + 0xFF1A1A1A, // surface_variant + 0xFFFFFFFF, // on_surface_variant + 0xFFFFFFFF, // outline + 0xFFB3B3B3, // outline_variant +]; + +struct AccessibilityPlugin; + +impl bindings::exports::fai::studio_plugin::theme::Guest for AccessibilityPlugin { + fn theme_for(brightness: String) -> Result { + let tokens = match brightness.as_str() { + "light" => ACCESSIBILITY_LIGHT.to_vec(), + "dark" => ACCESSIBILITY_DARK.to_vec(), + other => { + return Err(PluginError::Declined(format!( + "accessibility has no scheme for brightness '{other}' \ + (supported: light, dark)" + ))); + } + }; + Ok(ColorScheme { brightness, tokens }) + } +} + +impl bindings::exports::fai::studio_plugin::translate::Guest for AccessibilityPlugin { + fn translate( + _text: String, + _from_locale: String, + _to_locale: String, + ) -> Result { + Err(PluginError::Declined( + "accessibility is a theme plugin and does not translate".to_string(), + )) + } +} + +impl bindings::exports::fai::studio_plugin::output_view::Guest for AccessibilityPlugin { + fn render( + _mime_type: String, + _data: Vec, + ) -> Result { + Err(PluginError::Declined( + "accessibility is a theme plugin and does not render outputs" + .to_string(), + )) + } +} + +export_plugin!(AccessibilityPlugin);