feat: studio-theme-solarized v0.1.0 — skeleton

First Studio plugin in the new `studio.*` capability namespace.
SKELETON — does not yet compile.

Why ship the skeleton now:

  * Pins Ethan Schoonover's Solarized palette as two const
    Material 3 ColorScheme arrays so the in-tree reference
    doesn't bike-shed at SDK-integration time.
  * Gives the future fai-studio-plugin-sdk author a concrete
    consumer to validate the generated `#[plugin(theme)]`
    macro output against.
  * Validates that the WIT in fai/platform parses by being a
    real crate that references it.

What it does NOT yet do:

  * Compile. The `fai-studio-plugin-sdk` dependency it points
    at doesn't exist. Tracked in
    `fai/platform/docs/advanced/studio-plugin-sdk.md`.
  * Plug into Studio. The plugin-host module that would
    discover and invoke this component lives in the same
    deferred-Phase-1 work.

What it ships:

  * module.yaml declaring `provides: studio.theme.solarized`
    and `studio_extension.hooks: [theme]`.
  * Cargo.toml with the future SDK dependency commented out,
    crate-type=cdylib, component metadata.
  * src/lib.rs with both Solarized colour palettes
    (SOLARIZED_LIGHT and SOLARIZED_DARK), 14 ARGB tokens
    each in Material 3 order, plus the future `#[plugin]`
    function body commented out and two sanity tests on the
    palette constants.
  * README.md explaining the status and the steps to finish
    the plugin once the SDK ships.

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-05-25 13:24:00 +02:00
commit a1f8412205
5 changed files with 228 additions and 0 deletions

106
src/lib.rs Normal file
View file

@ -0,0 +1,106 @@
//! `studio.theme.solarized` — first Studio plugin.
//!
//! Ships Ethan Schoonover's Solarized palette as a Material 3
//! ColorScheme pair (light + dark).
//!
//! SKELETON: this file does not yet compile. The
//! `#[plugin(theme)]` macro and the `studio_plugin` runtime live
//! in `fai-studio-plugin-sdk`, which is documented in
//! `docs/advanced/studio-plugin-sdk.md` but not yet implemented.
//! Once the SDK ships, switching the file from skeleton to
//! buildable is a matter of uncommenting the dependency in
//! Cargo.toml and the use-line below.
//!
//! Why ship the skeleton now: pins the palette so the in-tree
//! reference plugin doesn't bike-shed at SDK-integration time,
//! and gives the SDK author a concrete consumer to validate
//! their generated macro output against.
#![allow(dead_code, unused_imports)]
// use fai_studio_plugin_sdk::{plugin, theme, ColorScheme};
/// 14 ARGB tokens, Material 3 order:
/// primary, on_primary, secondary, on_secondary,
/// tertiary, on_tertiary, error, on_error,
/// surface, on_surface, surface_variant, on_surface_variant,
/// outline, outline_variant.
///
/// Studio merges any missing slot (we send all 14, so none) with
/// its built-in fallback before applying.
const SOLARIZED_LIGHT: [u32; 14] = [
0xFF268BD2, // primary — solarized blue
0xFFFDF6E3, // on_primary — base3
0xFF2AA198, // secondary — solarized cyan
0xFFFDF6E3, // on_secondary — base3
0xFFB58900, // tertiary — solarized yellow
0xFF002B36, // on_tertiary — base03
0xFFDC322F, // error — solarized red
0xFFFDF6E3, // on_error — base3
0xFFFDF6E3, // surface — base3
0xFF073642, // on_surface — base02
0xFFEEE8D5, // surface_variant — base2
0xFF586E75, // on_surface_variant — base01
0xFF93A1A1, // outline — base1
0xFFEEE8D5, // outline_variant — base2
];
const SOLARIZED_DARK: [u32; 14] = [
0xFF268BD2, // primary — solarized blue
0xFF002B36, // on_primary — base03
0xFF2AA198, // secondary — solarized cyan
0xFF002B36, // on_secondary — base03
0xFFB58900, // tertiary — solarized yellow
0xFF002B36, // on_tertiary — base03
0xFFDC322F, // error — solarized red
0xFF002B36, // on_error — base03
0xFF002B36, // surface — base03
0xFF93A1A1, // on_surface — base1
0xFF073642, // surface_variant — base02
0xFF839496, // on_surface_variant — base0
0xFF586E75, // outline — base01
0xFF073642, // outline_variant — base02
];
// ─────────────────────────────────────────────────────────────
// Forward-reference: this is the shape the SDK will generate
// from `#[plugin(theme)]`. Once the SDK exists, the body collapses
// to a return of `Ok(ColorScheme { brightness, tokens: … })`.
// ─────────────────────────────────────────────────────────────
//
// #[plugin(theme)]
// fn theme_for(brightness: &str) -> theme::Result {
// let tokens = match brightness {
// "light" => SOLARIZED_LIGHT.to_vec(),
// "dark" => SOLARIZED_DARK.to_vec(),
// other => {
// return Err(theme::Error::declined(format!(
// "solarized has no scheme for brightness '{other}'",
// )))
// }
// };
// Ok(ColorScheme {
// brightness: brightness.to_string(),
// tokens,
// })
// }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn palette_has_14_tokens() {
assert_eq!(SOLARIZED_LIGHT.len(), 14);
assert_eq!(SOLARIZED_DARK.len(), 14);
}
#[test]
fn solarized_blue_is_the_primary_in_both_modes() {
// Ethan Schoonover's blue is the brand colour of
// Solarized. Sanity-check we kept it as the primary in
// both schemes.
assert_eq!(SOLARIZED_LIGHT[0], 0xFF268BD2);
assert_eq!(SOLARIZED_DARK[0], 0xFF268BD2);
}
}