Skip to content

Commit

Permalink
Brighten up some accent colors in the dark theme (#268)
Browse files Browse the repository at this point in the history
* Brighten up some accent colors in the dark theme
Fixes #267
  • Loading branch information
Feichtmeier committed Jan 28, 2023
1 parent 8768db5 commit e75843e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
10 changes: 3 additions & 7 deletions example/lib/view/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,9 @@ class HomePageState extends State<HomePage> {
),
actions: [
PopupMenuButton<Color>(
onSelected: (value) {},
child: SizedBox(
width: 40,
child: Icon(
Icons.color_lens,
color: Theme.of(context).primaryColor,
),
icon: Icon(
Icons.color_lens,
color: Theme.of(context).primaryColor,
),
itemBuilder: (context) {
return [
Expand Down
28 changes: 16 additions & 12 deletions lib/src/themes/common_themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ ElevatedButtonThemeData _getElevatedButtonThemeData({
return ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
backgroundColor: color,
foregroundColor: textColor ??
(ThemeData.estimateBrightnessForColor(color) == Brightness.light
? Colors.black
: Colors.white),
foregroundColor: textColor ?? contrastColor(color),
visualDensity: _commonButtonStyle.visualDensity,
elevation: 0,
shadowColor: Colors.transparent,
Expand Down Expand Up @@ -371,12 +368,12 @@ ThemeData createYaruLightTheme({
error: YaruColors.error,
brightness: Brightness.light,
primary: primaryColor,
onPrimary: Colors.white,
onPrimary: contrastColor(primaryColor),
primaryContainer: YaruColors.porcelain,
onPrimaryContainer: YaruColors.inkstone,
inversePrimary: YaruColors.inkstone,
secondary: elevatedButtonColor ?? primaryColor,
onSecondary: Colors.white,
onSecondary: contrastColor(elevatedButtonColor ?? primaryColor),
secondaryContainer:
elevatedButtonColor?.withOpacity(0.4) ?? primaryColor.withOpacity(0.4),
onSecondaryContainer: elevatedButtonTextColor ?? YaruColors.jet,
Expand Down Expand Up @@ -443,7 +440,7 @@ ThemeData createYaruLightTheme({
appBarTheme: _createLightAppBar(colorScheme),
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: elevatedButtonColor ?? primaryColor,
foregroundColor: elevatedButtonTextColor ?? Colors.white,
foregroundColor: contrastColor(elevatedButtonColor ?? primaryColor),
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
selectedItemColor: colorScheme.primary,
Expand All @@ -467,7 +464,7 @@ ThemeData createYaruLightTheme({
),
badgeTheme: BadgeThemeData(
backgroundColor: elevatedButtonColor ?? colorScheme.primary,
textColor: elevatedButtonTextColor ?? Colors.white,
textColor: contrastColor(elevatedButtonColor ?? primaryColor),
),
);
}
Expand All @@ -486,11 +483,11 @@ ThemeData createYaruDarkTheme({
brightness: Brightness.dark,
primary: primaryColor,
primaryContainer: YaruColors.coolGrey,
onPrimary: YaruColors.porcelain,
onPrimary: contrastColor(primaryColor),
onPrimaryContainer: YaruColors.porcelain,
inversePrimary: YaruColors.porcelain,
secondary: elevatedButtonColor ?? primaryColor,
onSecondary: Colors.white,
onSecondary: contrastColor(elevatedButtonColor ?? primaryColor),
secondaryContainer:
elevatedButtonColor?.withOpacity(0.4) ?? primaryColor.withOpacity(0.4),
onSecondaryContainer:
Expand Down Expand Up @@ -559,7 +556,7 @@ ThemeData createYaruDarkTheme({
appBarTheme: _createDarkAppBarTheme(colorScheme),
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: elevatedButtonColor ?? primaryColor,
foregroundColor: elevatedButtonTextColor ?? Colors.white,
foregroundColor: contrastColor(elevatedButtonColor ?? primaryColor),
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
selectedItemColor: colorScheme.primary,
Expand All @@ -582,11 +579,18 @@ ThemeData createYaruDarkTheme({
),
badgeTheme: BadgeThemeData(
backgroundColor: elevatedButtonColor ?? colorScheme.primary,
textColor: elevatedButtonTextColor ?? Colors.white,
textColor: contrastColor(elevatedButtonColor ?? primaryColor),
),
);
}

Color contrastColor(Color color) => ThemeData.estimateBrightnessForColor(
color,
) ==
Brightness.light
? Colors.black
: Colors.white;

PopupMenuThemeData _createPopupMenuThemeData(
ColorScheme colorScheme,
Brightness brightness,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/themes/xubuntu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ final yaruXubuntuLight = createYaruLightTheme(
);

final yaruXubuntuDark = createYaruDarkTheme(
primaryColor: _primaryColor,
primaryColor: _primaryColor.shade500,
);
4 changes: 2 additions & 2 deletions lib/src/themes/yaru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final yaruSageLight = createYaruLightTheme(
);

final yaruSageDark = createYaruDarkTheme(
primaryColor: YaruColors.sage,
primaryColor: YaruColors.sage.shade500,
);

final yaruPrussianGreenLight = createYaruLightTheme(
Expand All @@ -42,7 +42,7 @@ final yaruBarkLight = createYaruLightTheme(
);

final yaruBarkDark = createYaruDarkTheme(
primaryColor: YaruColors.bark,
primaryColor: YaruColors.bark.shade500,
);

final yaruViridianLight = createYaruLightTheme(
Expand Down

0 comments on commit e75843e

Please sign in to comment.