Skip to content

Commit

Permalink
builtInColorThemesを生成できるように
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Aug 13, 2023
1 parent 6c40ec1 commit 7ec3410
Show file tree
Hide file tree
Showing 3 changed files with 369 additions and 292 deletions.
65 changes: 65 additions & 0 deletions assets_builder/build_themes.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:json5/json5.dart';
import 'package:miria/model/color_theme.dart';
import 'package:miria/model/misskey_theme.dart';

void main() {
final themes = [
"l-light",
"d-dark",
"l-coffee",
"d-persimmon",
"l-apricot",
"d-astro",
"l-rainy",
"d-future",
"l-botanical",
"d-botanical",
"l-vivid",
"d-green-lime",
"l-cherry",
"d-green-orange",
"l-sushi",
"d-cherry",
"l-u0",
"d-ice",
"d-u0",
]
.map(
(name) => ColorTheme.misskey(
MisskeyTheme.fromJson(
JSON5.parse(
File(
"assets_builder/misskey/packages/frontend/src/themes/$name.json5",
).readAsStringSync(),
),
),
),
)
.map(
(theme) => 'ColorTheme('
'id: "${theme.id}", '
'name: "${theme.name}", '
'isDarkTheme: ${theme.isDarkTheme}, '
'primary: ${theme.primary}, '
'primaryDarken: ${theme.primaryDarken}, '
'primaryLighten: ${theme.primaryLighten}, '
'background: ${theme.background}, '
'foreground: ${theme.foreground}, '
'renote: ${theme.renote}, '
'mention: ${theme.mention}, '
'hashtag: ${theme.hashtag}, '
'link: ${theme.link}, '
'divider: ${theme.divider}, '
'buttonBackground: ${theme.buttonBackground}, '
'panel: ${theme.panel}, '
'panelBackground: ${theme.panelBackground}, '
')',
)
.toList();
// ignore: avoid_print
print(themes);
runApp(MaterialApp(home: Scaffold(body: SelectableText(themes.toString()))));
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class GeneralSettingsPageState extends ConsumerState<GeneralSettingsPage> {
.where((element) => !element.isDarkTheme))
DropdownMenuItem(
value: element.id,
child: Text(element.name),
child: Text("${element.name}っぽいの"),
)
],
value: lightModeTheme,
Expand All @@ -198,7 +198,7 @@ class GeneralSettingsPageState extends ConsumerState<GeneralSettingsPage> {
.where((element) => element.isDarkTheme))
DropdownMenuItem(
value: element.id,
child: Text(element.name),
child: Text("${element.name}っぽいの"),
)
],
value: darkModeTheme,
Expand Down
Loading

0 comments on commit 7ec3410

Please sign in to comment.