Siticone ThemeSwitcher
The SiticoneThemeSwitcher is an interactive, highly animated control designed to toggle between Light, Dark, and Auto (System) modes.
It features fluid morphing icons (Sun ↔ Moon), particle effects on click, ripple animations, and extensive customization options for styling the control to fit any application aesthetics.
State & Behavior
Properties controlling the active mode and interaction states of the switcher.
| Property | Type | Description & Usage Example |
|---|---|---|
CurrentMode |
ThemeMode |
switcher.CurrentMode = ThemeMode.Dark;
Gets or sets the active theme. Changing this triggers the morphing animation.
Options: Light (Sun), Dark (Moon), Auto (Checkmark/Auto icon).
|
AnimationDuration |
int | switcher.AnimationDuration = 400; Duration in milliseconds for state transitions (icon morphing, color fading). |
Appearance & Colors
Customize the visual palette for different interaction states.
| Property | Type | Description |
|---|---|---|
BackgroundColor |
Color | The background color in the resting state. |
HoverColor |
Color | The background color when the mouse pointer is over the control. |
PressColor |
Color | The background color when the control is being clicked. |
IconColor |
Color | The color of the central icon (Sun/Moon/Auto) and particle effects. |
BorderColor |
Color | The color of the control's border stroke. |
BorderWidth |
float | Thickness of the border. Set to 0 to remove. |
Icon Customization
Fine-tune the geometry and style of the morphing icons.
| Property | Type | Description |
|---|---|---|
IconScale |
float | switcher.IconScale = 0.8f; Scales the icon size relative to the control size (0.1 to 1.0). |
IconStrokeWidth |
float | Thickness of the lines used to draw the sun rays, moon crater, and checkmarks. |
SunRayCount |
int | Number of rays displayed when in Light mode (4-12). |
MoonPhase |
float | Controls the crescent shape of the moon in Dark mode (0.1 to 0.9). |
Shape & Layout
Control the geometry, rounding, and spacing of the component.
| Property | Type | Description |
|---|---|---|
MakeRadial |
bool | switcher.MakeRadial = true; If true, forces the control into a perfect circle, overriding individual corner radii. |
TopLeftRadius |
int | Radius for the top-left corner. |
TopRightRadius |
int | Radius for the top-right corner. |
BottomLeftRadius |
int | Radius for the bottom-left corner. |
BottomRightRadius |
int | Radius for the bottom-right corner. |
SurfacePadding |
float | Internal padding between the border and the icon content. |
GlowRadius |
float | switcher.GlowRadius = 10f; Size of the outer glow effect triggered on hover. |
Events
// Fired whenever the CurrentMode property changes (via click or code).
// Use this to trigger your application's actual theme update logic.
siticoneThemeSwitcher1.ThemeModeChanged += (sender, e) =>
{
Console.WriteLine($"Switched to: {e.SetTheme}");
ApplyThemeToApp(e.SetTheme);
};
Usage Examples
Example 1: Basic App Theme Integration
The most common use case: listening for the switch event to toggle the application's visual style.
public MainForm()
{
InitializeComponent();
// Set initial state
themeSwitcher.CurrentMode = ThemeMode.Light;
// Wire up the event
themeSwitcher.ThemeModeChanged += OnThemeChanged;
}
private void OnThemeChanged(object sender, ThemeModeChangedEventArgs e)
{
switch (e.SetTheme)
{
case ThemeMode.Light:
this.BackColor = Color.White;
this.ForeColor = Color.Black;
break;
case ThemeMode.Dark:
this.BackColor = Color.FromArgb(30, 30, 30);
this.ForeColor = Color.WhiteSmoke;
break;
case ThemeMode.Auto:
// Logic to detect system time or OS setting
bool isSystemDark = DetectSystemTheme();
OnThemeChanged(sender, new ThemeModeChangedEventArgs(
isSystemDark ? ThemeMode.Dark : ThemeMode.Light));
break;
}
}
Example 2: Programmatic Styling (Neon Theme)
You can completely change the visual feel of the switcher by setting its color and effect properties. This example creates a "Cyberpunk/Neon" look.
private void ApplyNeonStyle(SiticoneThemeSwitcher switcher)
{
// Backgrounds
switcher.BackgroundColor = Color.Black;
switcher.HoverColor = Color.FromArgb(20, 20, 20);
switcher.PressColor = Color.FromArgb(40, 40, 40);
// Neon Accents
switcher.IconColor = Color.Magenta;
switcher.BorderColor = Color.Cyan;
// Glow Effects
switcher.BorderWidth = 2f;
switcher.GlowRadius = 15f; // Strong glow
// Shape
switcher.MakeRadial = true; // Circular
switcher.IconScale = 0.6f;
switcher.IconStrokeWidth = 3f; // Thicker lines
}
Example 3: Toggle Button Logic
While the control toggles itself on click, you might want to cycle modes via an external button or keyboard shortcut.
private void BtnNextTheme_Click(object sender, EventArgs e)
{
// Cycle: Light -> Dark -> Auto -> Light...
ThemeMode current = themeSwitcher1.CurrentMode;
ThemeMode nextMode = (ThemeMode)(((int)current + 1) % 3);
themeSwitcher1.CurrentMode = nextMode;
}
Designer Smart Tags
The component includes a rich Smart Tag panel in the Visual Studio Designer. You can use this to instantly apply preset themes without writing code.
Access the menu by clicking the small arrow icon on the top-right corner of the control in the Visual Studio designer view.