Skip to content

Commit e0e45c2

Browse files
committed
refactor(theme): rename colors for generic branding
1 parent e1796a6 commit e0e45c2

File tree

13 files changed

+113
-55
lines changed

13 files changed

+113
-55
lines changed

examples/demo/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ cd ios && pod install && cd ..
2626
flutter run
2727
```
2828

29-
If multiple devices are connected, select one when prompted or specify it:
29+
For Android with multiple emulators, use the helper script to pick by AVD name:
30+
31+
```bash
32+
../run-android.sh
33+
```
34+
35+
Or specify a device directly:
3036

3137
```bash
3238
flutter run -d <device_id>

examples/demo/lib/screens/home_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class _HomeScreenState extends State<HomeScreen> {
159159
);
160160
},
161161
style: ElevatedButton.styleFrom(
162-
backgroundColor: AppColors.oneSignalRed,
162+
backgroundColor: AppColors.osPrimary,
163163
foregroundColor: Colors.white,
164164
),
165165
child: const Text('NEXT ACTIVITY'),

examples/demo/lib/theme.dart

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@ class AppSpacing {
99
}
1010

1111
class AppColors {
12-
static const oneSignalRed = Color(0xFFE54B4D);
13-
static const oneSignalGreen = Color(0xFF34A853);
14-
static const lightBackground = Color(0xFFF8F9FA);
15-
static const cardBackground = Colors.white;
16-
static const dividerColor = Color(0xFFE8EAED);
17-
static const warningBackground = Color(0xFFFFF8E1);
18-
static const sectionHeaderText = Color(0xFF616161);
19-
static const subtleText = Color(0xFF757575);
20-
12+
static const osPrimary = Color(0xFFE54B4D);
13+
static const osSuccess = Color(0xFF34A853);
14+
static const osGrey700 = Color(0xFF616161);
15+
static const osGrey600 = Color(0xFF757575);
16+
static const osGrey500 = Color(0xFF9E9E9E);
17+
static const osLightBackground = Color(0xFFF8F9FA);
18+
static const osCardBackground = Colors.white;
19+
static const osDivider = Color(0xFFE8EAED);
20+
static const osWarningBackground = Color(0xFFFFF8E1);
21+
static const osOverlayScrim = Color(0x42000000);
22+
static const osLogBackground = Color(0xFF1A1B1E);
23+
static const osLogDebug = Color(0xFF82AAFF);
24+
static const osLogInfo = Color(0xFFC3E88D);
25+
static const osLogWarn = Color(0xFFFFCB6B);
26+
static const osLogError = Color(0xFFFF5370);
27+
static const osLogTimestamp = Color(0xFF676E7B);
2128
AppColors._();
2229
}
2330

@@ -26,16 +33,16 @@ class AppTheme {
2633
return ThemeData(
2734
useMaterial3: true,
2835
colorScheme: ColorScheme.fromSeed(
29-
seedColor: AppColors.oneSignalRed,
30-
).copyWith(primary: AppColors.oneSignalRed),
31-
scaffoldBackgroundColor: AppColors.lightBackground,
36+
seedColor: AppColors.osPrimary,
37+
).copyWith(primary: AppColors.osPrimary),
38+
scaffoldBackgroundColor: AppColors.osLightBackground,
3239
appBarTheme: const AppBarTheme(
33-
backgroundColor: AppColors.oneSignalRed,
40+
backgroundColor: AppColors.osPrimary,
3441
foregroundColor: Colors.white,
3542
elevation: 0,
3643
),
3744
cardTheme: CardThemeData(
38-
color: AppColors.cardBackground,
45+
color: AppColors.osCardBackground,
3946
elevation: 1,
4047
shape: RoundedRectangleBorder(
4148
borderRadius: BorderRadius.circular(12),

examples/demo/lib/widgets/action_button.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PrimaryButton extends StatelessWidget {
2121
child: ElevatedButton(
2222
onPressed: onPressed,
2323
style: ElevatedButton.styleFrom(
24-
backgroundColor: AppColors.oneSignalRed,
24+
backgroundColor: AppColors.osPrimary,
2525
foregroundColor: Colors.white,
2626
),
2727
child: Row(
@@ -56,8 +56,8 @@ class DestructiveButton extends StatelessWidget {
5656
child: OutlinedButton(
5757
onPressed: onPressed,
5858
style: OutlinedButton.styleFrom(
59-
foregroundColor: AppColors.oneSignalRed,
60-
side: const BorderSide(color: AppColors.oneSignalRed),
59+
foregroundColor: AppColors.osPrimary,
60+
side: const BorderSide(color: AppColors.osPrimary),
6161
),
6262
child: Text(label),
6363
),

examples/demo/lib/widgets/dialogs.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ class TooltipDialog extends StatelessWidget {
710710
Text(
711711
option.description,
712712
style: Theme.of(context).textTheme.bodySmall?.copyWith(
713-
color: AppColors.subtleText,
713+
color: AppColors.osGrey600,
714714
),
715715
),
716716
],

examples/demo/lib/widgets/list_widgets.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class PairItem extends StatelessWidget {
3333
Text(
3434
valueText,
3535
style: Theme.of(context).textTheme.bodySmall?.copyWith(
36-
color: AppColors.subtleText,
36+
color: AppColors.osGrey600,
3737
),
3838
),
3939
],
@@ -42,7 +42,7 @@ class PairItem extends StatelessWidget {
4242
if (onDelete != null)
4343
GestureDetector(
4444
onTap: onDelete,
45-
child: Icon(Icons.close, size: 18, color: AppColors.sectionHeaderText),
45+
child: Icon(Icons.close, size: 18, color: AppColors.osPrimary),
4646
),
4747
],
4848
),
@@ -70,7 +70,7 @@ class SingleItem extends StatelessWidget {
7070
if (onDelete != null)
7171
GestureDetector(
7272
onTap: onDelete,
73-
child: Icon(Icons.close, size: 18, color: AppColors.sectionHeaderText),
73+
child: Icon(Icons.close, size: 18, color: AppColors.osPrimary),
7474
),
7575
],
7676
),
@@ -91,7 +91,7 @@ class EmptyState extends StatelessWidget {
9191
child: Text(
9292
text,
9393
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
94-
color: AppColors.subtleText,
94+
color: AppColors.osGrey600,
9595
),
9696
),
9797
),

examples/demo/lib/widgets/log_view.dart

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22

33
import '../services/log_manager.dart';
4+
import '../theme.dart';
45

56
class LogView extends StatefulWidget {
67
const LogView({super.key});
@@ -42,21 +43,25 @@ class _LogViewState extends State<LogView> {
4243
Color _levelColor(LogLevel level) {
4344
switch (level) {
4445
case LogLevel.debug:
45-
return Colors.blue;
46+
return AppColors.osLogDebug;
4647
case LogLevel.info:
47-
return Colors.green;
48+
return AppColors.osLogInfo;
4849
case LogLevel.warn:
49-
return Colors.amber;
50+
return AppColors.osLogWarn;
5051
case LogLevel.error:
51-
return Colors.red;
52+
return AppColors.osLogError;
5253
}
5354
}
5455

5556
@override
5657
Widget build(BuildContext context) {
5758
final logs = LogManager().logs;
59+
final textTheme = Theme.of(context).textTheme;
60+
final logEntryStyle = textTheme.labelSmall?.copyWith(
61+
fontFamily: 'monospace',
62+
);
5863

59-
const logBackground = Color(0xFF1A1B1E);
64+
const logBackground = AppColors.osLogBackground;
6065

6166
return Semantics(
6267
label: 'log_view_container',
@@ -78,9 +83,9 @@ class _LogViewState extends State<LogView> {
7883
),
7984
child: Row(
8085
children: [
81-
const Text(
86+
Text(
8287
'LOGS',
83-
style: TextStyle(
88+
style: textTheme.labelSmall?.copyWith(
8489
fontWeight: FontWeight.bold,
8590
color: Colors.white,
8691
),
@@ -90,7 +95,9 @@ class _LogViewState extends State<LogView> {
9095
label: 'log_view_count',
9196
child: Text(
9297
'(${logs.length})',
93-
style: TextStyle(color: Colors.grey[400]),
98+
style: textTheme.labelSmall?.copyWith(
99+
color: AppColors.osGrey500,
100+
),
94101
),
95102
),
96103
const Spacer(),
@@ -99,10 +106,10 @@ class _LogViewState extends State<LogView> {
99106
label: 'log_view_clear_button',
100107
child: GestureDetector(
101108
onTap: () => LogManager().clear(),
102-
child: Icon(
109+
child: const Icon(
103110
Icons.delete,
104111
size: 18,
105-
color: Colors.grey[400],
112+
color: AppColors.osGrey500,
106113
),
107114
),
108115
),
@@ -112,7 +119,7 @@ class _LogViewState extends State<LogView> {
112119
? Icons.expand_less
113120
: Icons.expand_more,
114121
size: 20,
115-
color: Colors.grey[400],
122+
color: AppColors.osGrey500,
116123
),
117124
],
118125
),
@@ -130,7 +137,9 @@ class _LogViewState extends State<LogView> {
130137
child: Center(
131138
child: Text(
132139
'No logs yet',
133-
style: TextStyle(color: Colors.grey[500]),
140+
style: textTheme.bodyMedium?.copyWith(
141+
color: AppColors.osGrey500,
142+
),
134143
),
135144
),
136145
)
@@ -153,10 +162,8 @@ class _LogViewState extends State<LogView> {
153162
label: 'log_entry_${index}_timestamp',
154163
child: Text(
155164
entry.formattedTime,
156-
style: TextStyle(
157-
fontSize: 11,
158-
color: Colors.grey[500],
159-
fontFamily: 'monospace',
165+
style: logEntryStyle?.copyWith(
166+
color: AppColors.osLogTimestamp,
160167
),
161168
),
162169
),
@@ -165,11 +172,9 @@ class _LogViewState extends State<LogView> {
165172
label: 'log_entry_${index}_level',
166173
child: Text(
167174
entry.levelLabel,
168-
style: TextStyle(
169-
fontSize: 11,
175+
style: logEntryStyle?.copyWith(
170176
fontWeight: FontWeight.bold,
171177
color: _levelColor(entry.level),
172-
fontFamily: 'monospace',
173178
),
174179
),
175180
),
@@ -179,10 +184,8 @@ class _LogViewState extends State<LogView> {
179184
label: 'log_entry_${index}_message',
180185
child: Text(
181186
'${entry.tag}: ${entry.message}',
182-
style: const TextStyle(
183-
fontSize: 11,
184-
fontFamily: 'monospace',
185-
color: Colors.white70,
187+
style: logEntryStyle?.copyWith(
188+
color: Colors.white,
186189
),
187190
),
188191
),

examples/demo/lib/widgets/section_card.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class SectionCard extends StatelessWidget {
3131
title.toUpperCase(),
3232
style: Theme.of(context).textTheme.bodySmall?.copyWith(
3333
fontWeight: FontWeight.bold,
34-
color: AppColors.sectionHeaderText,
34+
color: AppColors.osGrey700,
3535
letterSpacing: 0.5,
3636
),
3737
),
@@ -42,7 +42,7 @@ class SectionCard extends StatelessWidget {
4242
child: Icon(
4343
Icons.info_outline,
4444
size: 18,
45-
color: AppColors.sectionHeaderText,
45+
color: AppColors.osGrey500,
4646
),
4747
),
4848
],

examples/demo/lib/widgets/sections/app_section.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class AppSection extends StatelessWidget {
5050
SizedBox(
5151
width: double.infinity,
5252
child: Card(
53-
color: AppColors.warningBackground,
53+
color: AppColors.osWarningBackground,
5454
margin: EdgeInsets.zero,
5555
child: Padding(
5656
padding: const EdgeInsets.all(12),
@@ -69,7 +69,7 @@ class AppSection extends StatelessWidget {
6969
child: Text(
7070
'Get your keys at onesignal.com',
7171
style: Theme.of(context).textTheme.bodySmall?.copyWith(
72-
color: AppColors.oneSignalRed,
72+
color: AppColors.osPrimary,
7373
fontWeight: FontWeight.w600,
7474
),
7575
),

examples/demo/lib/widgets/sections/send_iam_section.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SendIamSection extends StatelessWidget {
2626
child: ElevatedButton(
2727
onPressed: () => vm.sendInAppMessage(type),
2828
style: ElevatedButton.styleFrom(
29-
backgroundColor: AppColors.oneSignalRed,
29+
backgroundColor: AppColors.osPrimary,
3030
foregroundColor: Colors.white,
3131
minimumSize: const Size(double.infinity, 48),
3232
shape: RoundedRectangleBorder(

0 commit comments

Comments
 (0)