Skip to content

Commit

Permalink
docs: theming
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraZiling committed May 25, 2024
1 parent 7f670a1 commit 6f7581a
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ Visit [SukiUI on Nuget.org](https://www.nuget.org/packages/SukiUI)

Download `SukiUI-dev` in artifacts

## 📄 Documentation

[SukiUI Documentation](https://kikipoulet.github.io/SukiUI/) *WIP*

[Wiki](https://github.com/kikipoulet/SukiUI/wiki)

## 📱 UI Theme

##### SukiUI contains a theme for AvaloniaUI's base controls with support for Light/Dark themes.
Expand Down
9 changes: 9 additions & 0 deletions docs/docs/documentation/theming/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Basic

SukiUI provide a `SukiTheme` class that permits to easily manipulate the theming of your app easily.

Get the SukiTheme Instance:

```csharp
SukiTheme theme = SukiTheme.GetInstance();
```
34 changes: 34 additions & 0 deletions docs/docs/documentation/theming/theme-color.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Color

`SukiTheme` allows app to switch color themes easily

<img src="https://i.ibb.co/ykzPqVY/theming-color.gif" alt="theming-color">

## Switch between available Color Theme

```csharp
SukiTheme.GetInstance().SwitchColorTheme();
```

## Switch to a specific Color Theme

```csharp
SukiTheme.GetInstance().ChangeColorTheme(SukiColor.Red);
```

## Create a Custom Color Theme, register it and switch to it

```csharp
var PurpleTheme = new SukiColorTheme("Purple", Colors.Purple, Colors.DarkBlue);
SukiTheme.GetInstance().AddColorTheme(PurpleTheme);
SukiTheme.GetInstance().ChangeColorTheme(PurpleTheme);
```

## ColorChanged Event

```csharp
SukiTheme.GetInstance().OnColorThemeChanged += theme =>
{
Console.WriteLine("Color theme change triggered !");
};
```
34 changes: 34 additions & 0 deletions docs/docs/documentation/theming/theme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Light & Dark

SukiUI use the [Theme Variant](https://docs.avaloniaui.net/docs/guides/styles-and-resources/how-to-use-theme-variants) system provided by `AvaloniaUI`.

However, the SukiTheme class provide an easiest wrapper to change Light/Dark theme.

<img src="https://i.ibb.co/XzzfB9r/theming-theme.gif" alt="theming-theme">

## Switch to Dark Theme

```csharp
SukiTheme.GetInstance().ChangeBaseTheme(ThemeVariant.Dark);
```

## Switch to Light Theme

```csharp
SukiTheme.GetInstance().ChangeBaseTheme(ThemeVariant.Light);
```

## Switch between Light/Dark Theme

```csharp
SukiTheme.GetInstance().SwitchBaseTheme();
```

## ThemeChanged Event

```csharp
SukiTheme.GetInstance().OnBaseThemeChanged += variant =>
{
Console.WriteLine("Theme changed triggered !");
};
```
9 changes: 9 additions & 0 deletions docs/docs/zh/documentation/theming/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 主题实例

SukiUI 提供 `SukiTheme`,通过该类可以实现对应用主题的修改

获取实例:

```csharp
SukiTheme theme = SukiTheme.GetInstance();
```
34 changes: 34 additions & 0 deletions docs/docs/zh/documentation/theming/theme-color.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 主题色

`SukiTheme` 也可以十分简单地切换应用的主题色

<img src="https://i.ibb.co/ykzPqVY/theming-color.gif" alt="theming-color">

## 在可用的主题色间切换

```csharp
SukiTheme.GetInstance().SwitchColorTheme();
```

## 切换到一个指定的主题色

```csharp
SukiTheme.GetInstance().ChangeColorTheme(SukiColor.Red);
```

## 创建/注册/切换到一个自定义主题色

```csharp
var PurpleTheme = new SukiColorTheme("Purple", Colors.Purple, Colors.DarkBlue);
SukiTheme.GetInstance().AddColorTheme(PurpleTheme);
SukiTheme.GetInstance().ChangeColorTheme(PurpleTheme);
```

## 订阅 ColorChanged 事件

```csharp
SukiTheme.GetInstance().OnColorThemeChanged += theme =>
{
Console.WriteLine("Color theme change triggered !");
};
```
32 changes: 32 additions & 0 deletions docs/docs/zh/documentation/theming/theme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 明暗主题切换

SukiUI 借助由 `AvaloniaUI` 提供的 [主题变体](https://docs.avaloniaui.net/zh-Hans/docs/guides/styles-and-resources/how-to-use-theme-variants) 轻松实现主题切换

<img src="https://i.ibb.co/XzzfB9r/theming-theme.gif" alt="theming-theme">

## 切换至暗色

```csharp
SukiTheme.GetInstance().ChangeBaseTheme(ThemeVariant.Dark);
```

## 切换至亮色

```csharp
SukiTheme.GetInstance().ChangeBaseTheme(ThemeVariant.Light);
```

## 明暗切换

```csharp
SukiTheme.GetInstance().SwitchBaseTheme();
```

## ThemeChanged 事件

```csharp
SukiTheme.GetInstance().OnBaseThemeChanged += variant =>
{
Console.WriteLine("Theme changed triggered !");
};
```

0 comments on commit 6f7581a

Please sign in to comment.