Skip to content

Commit

Permalink
Merge pull request #243 from Light-Beacon/2025newyear
Browse files Browse the repository at this point in the history
新年时合并
  • Loading branch information
Light-Beacon authored Jan 28, 2025
2 parents e38117c + 6a9d3e4 commit e860f21
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<local:MyCard Margin="3,8" MaxWidth="750">
<Border Margin="-3.5,-3" CornerRadius="5" Height="130">
<Border.Background>
<ImageBrush ImageSource="http://i0.hdslb.com/bfs/new_dyn/7693a697ff7d00838ff3928fef93c07e277543816.png" Stretch="UniformToFill" />
</Border.Background>
</Border>
</local:MyCard>
22 changes: 22 additions & 0 deletions Project/modules/ColorOverride.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from homepagebuilder.interfaces.Events import on, ResultOverride
from homepagebuilder.core.config import enable_by_config

COLOR_MAPPING = {
1: None,
2: "#9B2A2A",
3: "#C05252",
4: "#D56B6B",
5: "#E18E8E",
#6: "#E18E8E",
#7: "#E18E8E",
}

@on('page.generate.return')
@enable_by_config('news.replacecolor')
def script(*args, **kwargs):
result:str = kwargs['result']
for num, color in COLOR_MAPPING.items():
if not color:
continue
result = result.replace(f"{{DynamicResource ColorBrush{num}}}",color)
raise ResultOverride(result)
1 change: 1 addition & 0 deletions Project/pages/News.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ alias:
- 主界面
cards:
- animated_noticebar | s = false
- 2025ChineseNewYear
- ${@MainPageVersions|new}
- T:Separator | content = 历史版本
- ${@MainPageVersions|history}
Expand Down

0 comments on commit e860f21

Please sign in to comment.