From db271eedf70ae40ca9fa1c55c90668778b4e58e3 Mon Sep 17 00:00:00 2001 From: landaiqing Date: Fri, 18 Apr 2025 11:59:55 +0800 Subject: [PATCH] :sparkles: Add more themes and styles --- pixelnebula_test.go | 3 ++- style/cosmic_style.go | 14 ++++++++++++++ style/ghost_style.go | 14 ++++++++++++++ style/init.go | 24 ++++++++++++++++++++++++ style/mech_style.go | 14 ++++++++++++++ style/neon_style.go | 14 ++++++++++++++ style/pixel_style.go | 14 ++++++++++++++ style/style.go | 6 ++++++ style/watercolor_style.go | 14 ++++++++++++++ theme/cosmic_theme.go | 32 ++++++++++++++++++++++++++++++++ theme/ghost_theme.go | 32 ++++++++++++++++++++++++++++++++ theme/init.go | 24 ++++++++++++++++++++++++ theme/mech_theme.go | 32 ++++++++++++++++++++++++++++++++ theme/neon_theme.go | 32 ++++++++++++++++++++++++++++++++ theme/pixel_theme.go | 32 ++++++++++++++++++++++++++++++++ theme/watercolor_theme.go | 32 ++++++++++++++++++++++++++++++++ 16 files changed, 332 insertions(+), 1 deletion(-) create mode 100644 style/cosmic_style.go create mode 100644 style/ghost_style.go create mode 100644 style/mech_style.go create mode 100644 style/neon_style.go create mode 100644 style/pixel_style.go create mode 100644 style/watercolor_style.go create mode 100644 theme/cosmic_theme.go create mode 100644 theme/ghost_theme.go create mode 100644 theme/mech_theme.go create mode 100644 theme/neon_theme.go create mode 100644 theme/pixel_theme.go create mode 100644 theme/watercolor_theme.go diff --git a/pixelnebula_test.go b/pixelnebula_test.go index 190548c..3cae936 100644 --- a/pixelnebula_test.go +++ b/pixelnebula_test.go @@ -144,7 +144,8 @@ func TestDemo(t *testing.T) { pn := NewPixelNebula() // 设置风格和尺寸 - pn.WithStyle(style.GirlStyle) + pn.WithStyle(style.MechStyle) + pn.WithTheme(1) pn.WithSize(231, 231) // 生成 SVG 并保存到文件 diff --git a/style/cosmic_style.go b/style/cosmic_style.go new file mode 100644 index 0000000..932f029 --- /dev/null +++ b/style/cosmic_style.go @@ -0,0 +1,14 @@ +package style + +// CosmicStyle 宇宙风格类型 +const CosmicStyle StyleType = "cosmic" + +// CosmicStyleShapes 宇宙风格形状集合 +var CosmicStyleShapes = StyleSet{ + TypeClo: "", + TypeMouth: "", + TypeEyes: "", + TypeTop: "", + TypeHead: "", + TypeEnv: "", +} diff --git a/style/ghost_style.go b/style/ghost_style.go new file mode 100644 index 0000000..56f9adb --- /dev/null +++ b/style/ghost_style.go @@ -0,0 +1,14 @@ +package style + +// GhostStyle 幽灵风格类型 +const GhostStyle StyleType = "ghost" + +// GhostStyleShapes 幽灵风格形状集合 +var GhostStyleShapes = StyleSet{ + TypeClo: "", + TypeMouth: "", + TypeEyes: "", + TypeTop: "", + TypeHead: "", + TypeEnv: "", +} diff --git a/style/init.go b/style/init.go index 1388808..0ffad54 100644 --- a/style/init.go +++ b/style/init.go @@ -166,6 +166,24 @@ var defaultStyleSet = map[StyleType]StyleSet{ TypeHead: "", TypeEnv: "", }, + + // NeonStyle 风格 + NeonStyle: NeonStyleShapes, + + // PixelStyle 风格 + PixelStyle: PixelStyleShapes, + + // WatercolorStyle 风格 + WatercolorStyle: WatercolorStyleShapes, + + // MechStyle 风格 + MechStyle: MechStyleShapes, + + // CosmicStyle 风格 + CosmicStyle: CosmicStyleShapes, + + // GhostStyle 风格 + GhostStyle: GhostStyleShapes, } // initShapes 初始化形状数据 @@ -188,6 +206,12 @@ func (m *Manager) initShapes() { RastaStyle, MetaStyle, SquareStyle, + NeonStyle, // 霓虹风格 + PixelStyle, // 像素风格 + WatercolorStyle, // 水彩风格 + MechStyle, // 机械风格 + CosmicStyle, // 宇宙风格 + GhostStyle, // 幽灵风格 } { if styleSet, exists := defaultStyleSet[style]; exists { m.AddStyleSet(styleSet) diff --git a/style/mech_style.go b/style/mech_style.go new file mode 100644 index 0000000..b921fc2 --- /dev/null +++ b/style/mech_style.go @@ -0,0 +1,14 @@ +package style + +// MechStyle 机械风格类型 +const MechStyle StyleType = "mech" + +// MechStyleShapes 机械风格形状集合 +var MechStyleShapes = StyleSet{ + TypeClo: "", + TypeMouth: "", + TypeEyes: "", + TypeTop: "", + TypeHead: "", + TypeEnv: "", +} diff --git a/style/neon_style.go b/style/neon_style.go new file mode 100644 index 0000000..df95df8 --- /dev/null +++ b/style/neon_style.go @@ -0,0 +1,14 @@ +package style + +// NeonStyle 霓虹风格类型 +const NeonStyle StyleType = "neon" + +// NeonStyleShapes 霓虹风格形状集合 +var NeonStyleShapes = StyleSet{ + TypeClo: "", + TypeMouth: "", + TypeEyes: "", + TypeTop: "", + TypeHead: "", + TypeEnv: "", +} diff --git a/style/pixel_style.go b/style/pixel_style.go new file mode 100644 index 0000000..9e2e945 --- /dev/null +++ b/style/pixel_style.go @@ -0,0 +1,14 @@ +package style + +// PixelStyle 像素风格类型 +const PixelStyle StyleType = "pixel" + +// PixelStyleShapes 像素风格形状集合 +var PixelStyleShapes = StyleSet{ + TypeClo: "", + TypeMouth: "", + TypeEyes: "", + TypeTop: "", + TypeHead: "", + TypeEnv: "", +} diff --git a/style/style.go b/style/style.go index c4dcc95..2b8a268 100644 --- a/style/style.go +++ b/style/style.go @@ -106,6 +106,12 @@ func (m *Manager) GetStyleIndex(style StyleType) (int, error) { RastaStyle, MetaStyle, SquareStyle, + NeonStyle, // 霓虹风格 + PixelStyle, // 像素风格 + WatercolorStyle, // 水彩风格 + MechStyle, // 机械风格 + CosmicStyle, // 宇宙风格 + GhostStyle, // 幽灵风格 } { if s == style { return i, nil diff --git a/style/watercolor_style.go b/style/watercolor_style.go new file mode 100644 index 0000000..0ec14d3 --- /dev/null +++ b/style/watercolor_style.go @@ -0,0 +1,14 @@ +package style + +// WatercolorStyle 水彩风格类型 +const WatercolorStyle StyleType = "watercolor" + +// WatercolorStyleShapes 水彩风格形状集合 +var WatercolorStyleShapes = StyleSet{ + TypeClo: "", + TypeMouth: "", + TypeEyes: "", + TypeTop: "", + TypeHead: "", + TypeEnv: "", +} diff --git a/theme/cosmic_theme.go b/theme/cosmic_theme.go new file mode 100644 index 0000000..2bd159b --- /dev/null +++ b/theme/cosmic_theme.go @@ -0,0 +1,32 @@ +package theme + +// CosmicTheme 宇宙风格主题 +var CosmicTheme = Theme{ + // 第一部分 - 星空风格 + ThemePart{ + "env": {"000033"}, + "clo": {"000000", "8426c7"}, + "head": {"000000"}, + "mouth": {"ae00ff"}, + "eyes": {"5500ff", "00ffff"}, + "top": {"000000", "8426c7"}, + }, + // 第二部分 - 银河风格 + ThemePart{ + "env": {"0a001a"}, + "clo": {"000000", "00ffaa"}, + "head": {"000000"}, + "mouth": {"00ffaa"}, + "eyes": {"00aaff", "ffffff"}, + "top": {"000000", "00ffaa"}, + }, + // 第三部分 - 星云风格 + ThemePart{ + "env": {"330033"}, + "clo": {"000000", "ff00ff"}, + "head": {"000000"}, + "mouth": {"ff00ff"}, + "eyes": {"ff00aa", "ffffff"}, + "top": {"000000", "ff00ff"}, + }, +} diff --git a/theme/ghost_theme.go b/theme/ghost_theme.go new file mode 100644 index 0000000..e02f334 --- /dev/null +++ b/theme/ghost_theme.go @@ -0,0 +1,32 @@ +package theme + +// GhostTheme 幽灵风格主题 +var GhostTheme = Theme{ + // 第一部分 - 经典幽灵风格 + ThemePart{ + "env": {"1a1a1a"}, + "clo": {"ffffff", "ffffff"}, + "head": {"ffffff"}, + "mouth": {"000000"}, + "eyes": {"000000"}, + "top": {"ffffff"}, + }, + // 第二部分 - 蓝色幽灵风格 + ThemePart{ + "env": {"000033"}, + "clo": {"aaddff", "aaddff"}, + "head": {"aaddff"}, + "mouth": {"000000"}, + "eyes": {"000000"}, + "top": {"aaddff"}, + }, + // 第三部分 - 绿色幽灵风格 + ThemePart{ + "env": {"002211"}, + "clo": {"aaeecc", "aaeecc"}, + "head": {"aaeecc"}, + "mouth": {"000000"}, + "eyes": {"000000"}, + "top": {"aaeecc"}, + }, +} diff --git a/theme/init.go b/theme/init.go index d6c39b6..9eca896 100644 --- a/theme/init.go +++ b/theme/init.go @@ -484,6 +484,24 @@ var defaultThemeSet = map[style.StyleType]Theme{ "top": {"#00fffd", "none", "none", "none", "none"}, }, }, + + // 添加NeonStyle主题 + style.NeonStyle: NeonTheme, + + // 添加PixelStyle主题 + style.PixelStyle: PixelTheme, + + // 添加WatercolorStyle主题 + style.WatercolorStyle: WatercolorTheme, + + // 添加MechStyle主题 + style.MechStyle: MechTheme, + + // 添加CosmicStyle主题 + style.CosmicStyle: CosmicTheme, + + // 添加GhostStyle主题 + style.GhostStyle: GhostTheme, } // initThemes 初始化主题数据 @@ -507,6 +525,12 @@ func (m *Manager) initThemes() { style.RastaStyle, style.MetaStyle, style.SquareStyle, + style.NeonStyle, // 霓虹风格主题 + style.PixelStyle, // 像素风格主题 + style.WatercolorStyle, // 水彩风格主题 + style.MechStyle, // 机械风格主题 + style.CosmicStyle, // 宇宙风格主题 + style.GhostStyle, // 幽灵风格主题 } { if themeSet, exists := defaultThemeSet[theme]; exists { m.AddTheme(themeSet) diff --git a/theme/mech_theme.go b/theme/mech_theme.go new file mode 100644 index 0000000..024fcbb --- /dev/null +++ b/theme/mech_theme.go @@ -0,0 +1,32 @@ +package theme + +// MechTheme 机械风格主题 +var MechTheme = Theme{ + // 第一部分 - 钢铁机械风格 + ThemePart{ + "env": {"333333"}, + "clo": {"555555", "777777", "333333"}, + "head": {"888888"}, + "mouth": {"222222", "555555"}, + "eyes": {"333333", "73e8ff"}, + "top": {"444444", "777777", "222222", "555555"}, + }, + // 第二部分 - 铜色机械风格 + ThemePart{ + "env": {"251607"}, + "clo": {"805723", "ab752f", "553211"}, + "head": {"a87e45"}, + "mouth": {"302013", "604020"}, + "eyes": {"553211", "73e8ff"}, + "top": {"805723", "ab752f", "302013", "604020"}, + }, + // 第三部分 - 未来机械风格 + ThemePart{ + "env": {"002244"}, + "clo": {"1a1a1a", "333333", "007acc"}, + "head": {"444444"}, + "mouth": {"1a1a1a", "007acc"}, + "eyes": {"1a1a1a", "00ffff"}, + "top": {"1a1a1a", "333333", "007acc", "00aaff"}, + }, +} diff --git a/theme/neon_theme.go b/theme/neon_theme.go new file mode 100644 index 0000000..9bef2e8 --- /dev/null +++ b/theme/neon_theme.go @@ -0,0 +1,32 @@ +package theme + +// NeonTheme 霓虹风格主题 +var NeonTheme = Theme{ + // 第一部分 - 赛博朋克风格 + ThemePart{ + "env": {"000000"}, + "clo": {"1e1e1e", "5c5c5c", "00f2ff"}, + "head": {"000000"}, + "mouth": {"ff00d4", "00f2ff"}, + "eyes": {"ff00d4", "00f2ff", "ffffff", "ffffff"}, + "top": {"1e1e1e", "00f2ff", "ff00d4"}, + }, + // 第二部分 - 霓虹黄风格 + ThemePart{ + "env": {"0d0030"}, + "clo": {"1e1e1e", "5c5c5c", "ffdd00"}, + "head": {"000000"}, + "mouth": {"ffdd00", "00f2ff"}, + "eyes": {"ffdd00", "00f2ff", "ffffff", "ffffff"}, + "top": {"1e1e1e", "00f2ff", "ffdd00"}, + }, + // 第三部分 - 霓虹绿风格 + ThemePart{ + "env": {"100a00"}, + "clo": {"1e1e1e", "5c5c5c", "0cff6f"}, + "head": {"000000"}, + "mouth": {"0cff6f", "ff00d4"}, + "eyes": {"0cff6f", "ff00d4", "ffffff", "ffffff"}, + "top": {"1e1e1e", "ff00d4", "0cff6f"}, + }, +} diff --git a/theme/pixel_theme.go b/theme/pixel_theme.go new file mode 100644 index 0000000..61dc248 --- /dev/null +++ b/theme/pixel_theme.go @@ -0,0 +1,32 @@ +package theme + +// PixelTheme 像素风格主题 +var PixelTheme = Theme{ + // 第一部分 - 经典像素风格 + ThemePart{ + "env": {"333333"}, + "clo": {"3F51B5"}, + "head": {"ffcc99"}, + "mouth": {"cc0000"}, + "eyes": {"000000"}, + "top": {"663300"}, + }, + // 第二部分 - 像素游戏风格 + ThemePart{ + "env": {"4CAF50"}, + "clo": {"607D8B"}, + "head": {"ffbb77"}, + "mouth": {"333333"}, + "eyes": {"333333"}, + "top": {"ff9900"}, + }, + // 第三部分 - 复古像素风格 + ThemePart{ + "env": {"C62828"}, + "clo": {"9C27B0"}, + "head": {"CDDC39"}, + "mouth": {"000000"}, + "eyes": {"000000"}, + "top": {"FF5722"}, + }, +} diff --git a/theme/watercolor_theme.go b/theme/watercolor_theme.go new file mode 100644 index 0000000..32c56ad --- /dev/null +++ b/theme/watercolor_theme.go @@ -0,0 +1,32 @@ +package theme + +// WatercolorTheme 水彩风格主题 +var WatercolorTheme = Theme{ + // 第一部分 - 粉色水彩风格 + ThemePart{ + "env": {"ffeeff"}, + "clo": {"f7f7f7", "dddddd"}, + "head": {"fff0e8"}, + "mouth": {"ff5599", "ff5599"}, + "eyes": {"5544aa", "5544aa"}, + "top": {"dddddd", "cccccc"}, + }, + // 第二部分 - 蓝色水彩风格 + ThemePart{ + "env": {"eeffff"}, + "clo": {"f7f7f7", "dddddd"}, + "head": {"fff0f0"}, + "mouth": {"00aabb", "00aabb"}, + "eyes": {"3355dd", "3355dd"}, + "top": {"ccddff", "bbccee"}, + }, + // 第三部分 - 绿色水彩风格 + ThemePart{ + "env": {"eeffee"}, + "clo": {"f7f7f7", "dddddd"}, + "head": {"fffcf0"}, + "mouth": {"66aa66", "66aa66"}, + "eyes": {"006600", "006600"}, + "top": {"ddffdd", "cceecc"}, + }, +}