Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::DesignExport Class Reference

Export a Theme's design tokens to various output formats. More...

#include <design_export.hpp>

Static Public Member Functions

static std::string to_json (const Theme &theme)
 Export to JSON (round-trippable with Theme::from_json).
static std::string to_css (const Theme &theme, const std::string &prefix="pulp")
 Export to CSS custom properties.
static std::string to_cpp_header (const Theme &theme, const std::string &namespace_name)
 Export to a C++ header with constexpr color/dimension values.
static std::string to_oklch_css (const Theme &theme, const std::string &prefix="pulp")
 Export to OKLCH CSS color format.
static std::string to_wgsl_uniforms (const Theme &theme, const std::string &struct_name="ThemeUniforms")
 Export to GPU shader uniform declarations (WGSL).

Detailed Description

Export a Theme's design tokens to various output formats.

Design tokens are the structured data behind a plugin's visual identity: colors, dimensions, typography, widget geometry, and rendering styles.

Theme theme = load_theme("dark.json");
auto json = DesignExport::to_json(theme);
auto css = DesignExport::to_css(theme);
auto cpp = DesignExport::to_cpp_header(theme, "my_theme");
static std::string to_json(const Theme &theme)
Export to JSON (round-trippable with Theme::from_json).
static std::string to_cpp_header(const Theme &theme, const std::string &namespace_name)
Export to a C++ header with constexpr color/dimension values.
static std::string to_css(const Theme &theme, const std::string &prefix="pulp")
Export to CSS custom properties.
Definition theme.hpp:32

Member Function Documentation

◆ to_cpp_header()

std::string pulp::view::DesignExport::to_cpp_header ( const Theme & theme,
const std::string & namespace_name )
static

Export to a C++ header with constexpr color/dimension values.

namespace my_theme {
constexpr uint32_t kBackground = 0xFF1a1a2e;
constexpr float kKnobSize = 60.0f;
}

◆ to_css()

std::string pulp::view::DesignExport::to_css ( const Theme & theme,
const std::string & prefix = "pulp" )
static

Export to CSS custom properties.

:root {
--pulp-background: #1a1a2e;
--pulp-accent: #e94560;
--pulp-knob-size: 60px;
}
@ px
Absolute pixels.
Definition geometry.hpp:393
@ knob
Definition design_ir.hpp:260
Definition analyzer_provider.hpp:12

◆ to_json()

std::string pulp::view::DesignExport::to_json ( const Theme & theme)
static

Export to JSON (round-trippable with Theme::from_json).

◆ to_oklch_css()

std::string pulp::view::DesignExport::to_oklch_css ( const Theme & theme,
const std::string & prefix = "pulp" )
static

Export to OKLCH CSS color format.

--pulp-accent: oklch(0.628 0.258 12.5);

◆ to_wgsl_uniforms()

std::string pulp::view::DesignExport::to_wgsl_uniforms ( const Theme & theme,
const std::string & struct_name = "ThemeUniforms" )
static

Export to GPU shader uniform declarations (WGSL).

struct ThemeUniforms {
background: vec4<f32>,
accent: vec4<f32>,
knob_size: f32,
};

The documentation for this class was generated from the following file: