20 editing_theme_ = std::move(
theme);
34 std::string
export_json()
const {
return editing_theme_.to_json(); }
38 std::vector<std::string> names;
39 names.reserve(editing_theme_.colors.size());
40 for (
auto& [
k, _] : editing_theme_.colors)
47 selected_token_ = name;
48 auto it = editing_theme_.colors.find(name);
49 if (it != editing_theme_.colors.end()) {
50 picker_color_ = it->second;
60 void build_swatches();
63 std::string selected_token_;
65 float swatch_size_ = 24.0f;
66 float swatch_gap_ = 4.0f;
Definition canvas.hpp:240
void paint(canvas::Canvas &canvas) override
const Theme & editing_theme() const
Get the current edited theme.
Definition theme_editor.hpp:25
void select_token(const std::string &name)
Set the currently selected token (opens ColorPicker for it).
Definition theme_editor.hpp:46
std::string export_json() const
Export the current theme as JSON.
Definition theme_editor.hpp:34
std::function< void(const std::string &token, Color new_color)> on_color_changed
Callback when any color token is changed.
Definition theme_editor.hpp:28
std::vector< std::string > token_names() const
Get the list of color token names in the theme.
Definition theme_editor.hpp:37
std::function< void(const Theme &theme)> on_export
Callback when the entire theme is exported (e.g., save button).
Definition theme_editor.hpp:31
const std::string & selected_token() const
Definition theme_editor.hpp:54
void set_theme(Theme theme)
Set the theme to edit. Changes are applied in real-time.
Definition theme_editor.hpp:19
const Theme & theme() const
Definition view.hpp:213
Definition affine_transform.hpp:24
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
canvas::Color Color
Definition theme.hpp:12
@ k
Definition input_events.hpp:40