mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: pure black theme
Closes #254 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -97,3 +97,21 @@ extension Unique<E, Id> on List<E> {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
extension ColorExtension on Color {
|
||||
Color darken([double amount = .5]) {
|
||||
assert(amount >= 0 && amount <= 1, 'Amount must be between 0 and 1');
|
||||
return Color.lerp(this, Colors.black, amount)!;
|
||||
}
|
||||
|
||||
Color blend(Color color, [double fraction = 0.5]) {
|
||||
assert(fraction >= 0 && fraction <= 1, 'Fraction must be between 0 and 1');
|
||||
final blendedRed = (red * (1 - fraction) + color.red * fraction).toInt();
|
||||
final blendedGreen =
|
||||
(green * (1 - fraction) + color.green * fraction).toInt();
|
||||
final blendedBlue = (blue * (1 - fraction) + color.blue * fraction).toInt();
|
||||
final blendedAlpha =
|
||||
(alpha * (1 - fraction) + color.alpha * fraction).toInt();
|
||||
return Color.fromARGB(blendedAlpha, blendedRed, blendedGreen, blendedBlue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,6 +367,9 @@ class GStorage {
|
||||
static bool get coinWithLike =>
|
||||
GStorage.setting.get(SettingBoxKey.coinWithLike, defaultValue: false);
|
||||
|
||||
static bool get isPureBlackTheme =>
|
||||
GStorage.setting.get(SettingBoxKey.isPureBlackTheme, defaultValue: false);
|
||||
|
||||
static List<double> get dynamicDetailRatio => List<double>.from(setting
|
||||
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
|
||||
|
||||
@@ -599,6 +602,7 @@ class SettingBoxKey {
|
||||
showDmChart = 'showDmChart',
|
||||
enableCommAntifraud = 'enableCommAntifraud',
|
||||
coinWithLike = 'coinWithLike',
|
||||
isPureBlackTheme = 'isPureBlackTheme',
|
||||
|
||||
// Sponsor Block
|
||||
enableSponsorBlock = 'enableSponsorBlock',
|
||||
|
||||
@@ -44,6 +44,56 @@ class Utils {
|
||||
|
||||
static const channel = MethodChannel("PiliPlus");
|
||||
|
||||
static darkenTheme(ThemeData themeData) {
|
||||
// return themeData;
|
||||
Color color = themeData.colorScheme.surfaceContainerHighest.darken(0.7);
|
||||
return themeData.copyWith(
|
||||
scaffoldBackgroundColor: Colors.black,
|
||||
appBarTheme: themeData.appBarTheme.copyWith(
|
||||
backgroundColor: Colors.black,
|
||||
),
|
||||
cardTheme: themeData.cardTheme.copyWith(
|
||||
color: Colors.black,
|
||||
),
|
||||
dialogTheme: themeData.dialogTheme.copyWith(
|
||||
backgroundColor: color,
|
||||
),
|
||||
bottomSheetTheme:
|
||||
themeData.bottomSheetTheme.copyWith(backgroundColor: color),
|
||||
bottomNavigationBarTheme:
|
||||
themeData.bottomNavigationBarTheme.copyWith(backgroundColor: color),
|
||||
navigationBarTheme:
|
||||
themeData.navigationBarTheme.copyWith(backgroundColor: color),
|
||||
navigationRailTheme:
|
||||
themeData.navigationRailTheme.copyWith(backgroundColor: Colors.black),
|
||||
colorScheme: themeData.colorScheme.copyWith(
|
||||
primary: themeData.colorScheme.primary.darken(0.1),
|
||||
onPrimary: themeData.colorScheme.onPrimary.darken(0.1),
|
||||
primaryContainer: themeData.colorScheme.primaryContainer.darken(0.1),
|
||||
onPrimaryContainer:
|
||||
themeData.colorScheme.onPrimaryContainer.darken(0.1),
|
||||
inversePrimary: themeData.colorScheme.inversePrimary.darken(0.1),
|
||||
secondary: themeData.colorScheme.secondary.darken(0.1),
|
||||
onSecondary: themeData.colorScheme.onSecondary.darken(0.1),
|
||||
secondaryContainer:
|
||||
themeData.colorScheme.secondaryContainer.darken(0.1),
|
||||
onSecondaryContainer:
|
||||
themeData.colorScheme.onSecondaryContainer.darken(0.1),
|
||||
error: themeData.colorScheme.error.darken(0.1),
|
||||
surface: Colors.black,
|
||||
onSurface: themeData.colorScheme.onSurface.darken(0.15),
|
||||
surfaceTint: themeData.colorScheme.surfaceTint.darken(),
|
||||
inverseSurface: themeData.colorScheme.inverseSurface.darken(),
|
||||
onInverseSurface: themeData.colorScheme.onInverseSurface.darken(),
|
||||
surfaceContainer: themeData.colorScheme.surfaceContainer.darken(),
|
||||
surfaceContainerHigh:
|
||||
themeData.colorScheme.surfaceContainerHigh.darken(),
|
||||
surfaceContainerHighest:
|
||||
themeData.colorScheme.surfaceContainerHighest.darken(0.4),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static void onCopyOrMove({
|
||||
required BuildContext context,
|
||||
required bool isCopy,
|
||||
|
||||
Reference in New Issue
Block a user