chore: initial studio-theme-accessibility 0.1.0

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-06-02 01:35:53 +02:00
commit 7212a58ba5
9 changed files with 199 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
target/
Cargo.lock

32
Cargo.toml Normal file
View file

@ -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 <platform@flemming.ai>"]
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

8
MODULE.de.md Normal file
View file

@ -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.

20
MODULE.md Normal file
View file

@ -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.

22
README.md Normal file
View file

@ -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).

BIN
module.wasm Normal file

Binary file not shown.

17
module.yaml Normal file
View file

@ -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

4
rust-toolchain.toml Normal file
View file

@ -0,0 +1,4 @@
[toolchain]
channel = "1.86"
targets = ["wasm32-wasip2"]
components = ["rustfmt", "clippy"]

94
src/lib.rs Normal file
View file

@ -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<ColorScheme, PluginError> {
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<String, PluginError> {
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<u8>,
) -> Result<RenderedOutput, PluginError> {
Err(PluginError::Declined(
"accessibility is a theme plugin and does not render outputs"
.to_string(),
))
}
}
export_plugin!(AccessibilityPlugin);