Restore green/red/blue run status colours
The Material cleanup mapped run states to theme roles, which made succeeded runs use tertiary (reddish in the app theme).
This commit is contained in:
@@ -33,16 +33,19 @@ class RunStatusIcon extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The dynamic colour for a run state, shared by every status glyph.
|
/// The colour for a run state, shared by every status glyph: green
|
||||||
|
/// succeeded, red failed, blue running, yellow waiting, orange interrupted,
|
||||||
|
/// grey otherwise, each with a brighter dark-mode shade.
|
||||||
Color runStatusColor(String state, [ColorScheme? colorScheme]) {
|
Color runStatusColor(String state, [ColorScheme? colorScheme]) {
|
||||||
final scheme = colorScheme ?? const ColorScheme.light();
|
final dark = (colorScheme?.brightness ?? Brightness.light) == Brightness.dark;
|
||||||
return switch (state) {
|
return switch (state) {
|
||||||
'succeeded' => scheme.tertiary,
|
'succeeded' => dark ? const Color(0xFF30D158) : const Color(0xFF34C759),
|
||||||
'failed' => scheme.error,
|
'failed' => dark ? const Color(0xFFFF453A) : const Color(0xFFFF3B30),
|
||||||
'running' || 'active' => scheme.primary,
|
'running' ||
|
||||||
'waiting' => scheme.secondary,
|
'active' => dark ? const Color(0xFF0A84FF) : const Color(0xFF007AFF),
|
||||||
'interrupted' => scheme.tertiary,
|
'waiting' => dark ? const Color(0xFFFFD60A) : const Color(0xFFFFCC00),
|
||||||
_ => scheme.onSurfaceVariant,
|
'interrupted' => dark ? const Color(0xFFFF9F0A) : const Color(0xFFFF9500),
|
||||||
|
_ => const Color(0xFF8E8E93),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ void main() {
|
|||||||
expect(graphStatusState('waiting'), 'waiting');
|
expect(graphStatusState('waiting'), 'waiting');
|
||||||
expect(graphStatusState('mystery'), 'unknown');
|
expect(graphStatusState('mystery'), 'unknown');
|
||||||
const scheme = ColorScheme.light();
|
const scheme = ColorScheme.light();
|
||||||
expect(runStatusColor('succeeded', scheme), scheme.tertiary);
|
expect(runStatusColor('succeeded', scheme), const Color(0xFF34C759));
|
||||||
expect(runStatusColor('waiting', scheme), scheme.secondary);
|
expect(runStatusColor('waiting', scheme), const Color(0xFFFFCC00));
|
||||||
expect(runStatusColor('canceled', scheme), scheme.onSurfaceVariant);
|
expect(runStatusColor('canceled', scheme), const Color(0xFF8E8E93));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user