ivy-create-theme
Create or modify a custom theme in an Ivy project.
Pre-flight: Read Learnings
If the file .ivy/learnings/ivy-create-theme.md exists in the project directory, read it first and apply any lessons learned from previous runs of this skill.
Reference Files
Read before implementing:
- references/AGENTS.md -- Ivy framework API reference (widgets, hooks, layouts, inputs, colors)
Getting Started
- Use
ivy docs to read about theming (query: "theming" or "custom theme").
- Check if the user's
Program.cs already has a UseTheme(...) call.
- If it does, follow the Modify an Existing Theme path.
- If it does not, follow the Create a New Theme path.
Path A: Create a New Theme
If it is not clear from context, ask the user for details about the theme they want to create (colors, typography, dark/light preferences, etc.).
Create a file at Themes/[ThemeName].cs with a class that extends Theme:
using Ivy;
namespace [ProjectNamespace].Themes;
public class MyTheme : Theme
{
public MyTheme()
{
Name = "MyTheme";
Colors = new ThemeColorScheme
{
Light = new ThemeColors { /* ... */ },
Dark = new ThemeColors { /* ... */ }
};
...
}
}
- In
Program.cs, add .UseTheme(new MyTheme()) to the server builder chain. This MUST be BEFORE .Run(). The framework auto-detects the subclass and creates a factory via Activator.CreateInstance for hot reload.
Inline Configuration Approach
If the user prefers inline configuration instead of a separate class:
In Program.cs, add .UseTheme(theme => { ... }) to the server builder chain. This MUST be BEFORE .Run(). The framework wraps the callback in a factory for hot reload.
.UseTheme(theme =>
{
theme.Name = "MyTheme";
theme.Colors = new ThemeColorScheme
{
Light = new ThemeColors { /* ... */ },
Dark = new ThemeColors { /* ... */ }
};
})
Path B: Modify an Existing Theme
Find the existing UseTheme(...) call in Program.cs. Determine which pattern is used:
UseTheme(new MyTheme()) -- find and edit the theme subclass file
UseTheme(theme => { ... }) -- edit the inline callback in Program.cs
UseTheme(SomeTheme.Create) -- find and edit the factory method
Ask the user what they want to change (colors, typography, border radius, etc.) if it is not already clear from context.
Apply the changes to the theme definition.
Verification
Run dotnet build to verify everything compiles. Fix any errors.
If the user asks to commit, create a git commit with a descriptive message.
Present a short summary to the user describing what was created or changed.
Post-run: Evaluate and Improve
After completing the task:
- Evaluate: Did the build succeed? Were there compilation errors, unexpected behavior, or manual corrections needed during this run?
- Update learnings: If anything required correction or was surprising, append a concise entry to
.ivy/learnings/ivy-create-theme.md (create the file and .ivy/learnings/ directory if they don't exist). Each entry should note: the date, what went wrong, why, and what to do differently next time.
- Skip if clean: If everything succeeded without issues, do not update the learnings file.
1---2name: ivy-create-theme3description: Create or modify a custom Ivy theme. Use when the user asks to create a theme, change colors, update typography, modify the look and feel, customize the UI appearance, set dark mode colors, or adjust border radius, spacing, or other visual styling in their Ivy project.4---56# ivy-create-theme78Create or modify a custom theme in an Ivy project.910## Pre-flight: Read Learnings1112If the file `.ivy/learnings/ivy-create-theme.md` exists in the project directory, read it first and apply any lessons learned from previous runs of this skill.1314## Reference Files1516Read before implementing:17- [references/AGENTS.md](references/AGENTS.md) -- Ivy framework API reference (widgets, hooks, layouts, inputs, colors)1819## Getting Started20211. Use `ivy docs` to read about theming (query: "theming" or "custom theme").222. Check if the user's `Program.cs` already has a `UseTheme(...)` call.23 - If it does, follow the **Modify an Existing Theme** path.24 - If it does not, follow the **Create a New Theme** path.2526## Path A: Create a New Theme27281. If it is not clear from context, ask the user for details about the theme they want to create (colors, typography, dark/light preferences, etc.).29302. Create a file at `Themes/[ThemeName].cs` with a class that extends `Theme`:3132```csharp33using Ivy;3435namespace [ProjectNamespace].Themes;3637public class MyTheme : Theme38{39 public MyTheme()40 {41 Name = "MyTheme";42 Colors = new ThemeColorScheme43 {44 Light = new ThemeColors { /* ... */ },45 Dark = new ThemeColors { /* ... */ }46 };47 ...48 }49}50```51523. In `Program.cs`, add `.UseTheme(new MyTheme())` to the server builder chain. This MUST be BEFORE `.Run()`. The framework auto-detects the subclass and creates a factory via `Activator.CreateInstance` for hot reload.5354### Inline Configuration Approach5556If the user prefers inline configuration instead of a separate class:5758In `Program.cs`, add `.UseTheme(theme => { ... })` to the server builder chain. This MUST be BEFORE `.Run()`. The framework wraps the callback in a factory for hot reload.5960```csharp61.UseTheme(theme =>62{63 theme.Name = "MyTheme";64 theme.Colors = new ThemeColorScheme65 {66 Light = new ThemeColors { /* ... */ },67 Dark = new ThemeColors { /* ... */ }68 };69})70```7172## Path B: Modify an Existing Theme73741. Find the existing `UseTheme(...)` call in `Program.cs`. Determine which pattern is used:75 - `UseTheme(new MyTheme())` -- find and edit the theme subclass file76 - `UseTheme(theme => { ... })` -- edit the inline callback in Program.cs77 - `UseTheme(SomeTheme.Create)` -- find and edit the factory method78792. Ask the user what they want to change (colors, typography, border radius, etc.) if it is not already clear from context.80813. Apply the changes to the theme definition.8283## Verification84851. Run `dotnet build` to verify everything compiles. Fix any errors.86872. If the user asks to commit, create a git commit with a descriptive message.88893. Present a short summary to the user describing what was created or changed.9091## Post-run: Evaluate and Improve9293After completing the task:94951. **Evaluate**: Did the build succeed? Were there compilation errors, unexpected behavior, or manual corrections needed during this run?962. **Update learnings**: If anything required correction or was surprising, append a concise entry to `.ivy/learnings/ivy-create-theme.md` (create the file and `.ivy/learnings/` directory if they don't exist). Each entry should note: the date, what went wrong, why, and what to do differently next time.973. **Skip if clean**: If everything succeeded without issues, do not update the learnings file.