diff --git a/packages/flutter/lib/src/material/color_scheme.dart b/packages/flutter/lib/src/material/color_scheme.dart index 9d387a9be2..7278faf675 100644 --- a/packages/flutter/lib/src/material/color_scheme.dart +++ b/packages/flutter/lib/src/material/color_scheme.dart @@ -76,16 +76,16 @@ class ColorScheme extends Diagnosticable { assert(onError != null), assert(brightness != null); - /// Create dark version of the - /// [baseline Material color scheme](https://material.io/design/color/the-color-system.html#color-theme-creation). + /// Create the recommended dark color scheme that matches the + /// [baseline Material color scheme](https://material.io/design/color/dark-theme.html#ui-application). const ColorScheme.dark({ this.primary = const Color(0xffbb86fc), - this.primaryVariant = const Color(0xff4b01d0), + this.primaryVariant = const Color(0xff3700B3), this.secondary = const Color(0xff03dac6), this.secondaryVariant = const Color(0xff03dac6), - this.surface = Colors.black, - this.background = Colors.black, - this.error = const Color(0xffb00020), + this.surface = const Color(0xff121212), + this.background = const Color(0xff121212), + this.error = const Color(0xffcf6679), this.onPrimary = Colors.black, this.onSecondary = Colors.black, this.onSurface = Colors.white, diff --git a/packages/flutter/test/material/color_scheme_test.dart b/packages/flutter/test/material/color_scheme_test.dart new file mode 100644 index 0000000000..d6c74a9c2b --- /dev/null +++ b/packages/flutter/test/material/color_scheme_test.dart @@ -0,0 +1,48 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + + test('light scheme matches the spec', () { + // Colors should match the The Material Design baseline default theme: + // https://material.io/design/color/dark-theme.html#ui-application + const ColorScheme scheme = ColorScheme.light(); + expect(scheme.primary, const Color(0xff6200ee)); + expect(scheme.primaryVariant, const Color(0xff3700b3)); + expect(scheme.secondary, const Color(0xff03dac6)); + expect(scheme.secondaryVariant, const Color(0xff018786)); + expect(scheme.background, const Color(0xffffffff)); + expect(scheme.surface, const Color(0xffffffff)); + expect(scheme.error, const Color(0xffb00020)); + expect(scheme.onPrimary, const Color(0xffffffff)); + expect(scheme.onSecondary, const Color(0xff000000)); + expect(scheme.onBackground, const Color(0xff000000)); + expect(scheme.onSurface, const Color(0xff000000)); + expect(scheme.onError, const Color(0xffffffff)); + expect(scheme.brightness, Brightness.light); + }); + + test('dark scheme matches the spec', () { + // Colors should match the The Material Design baseline dark theme: + // https://material.io/design/color/dark-theme.html#ui-application + const ColorScheme scheme = ColorScheme.dark(); + expect(scheme.primary, const Color(0xffbb86fc)); + expect(scheme.primaryVariant, const Color(0xff3700b3)); + expect(scheme.secondary, const Color(0xff03dac6)); + expect(scheme.secondaryVariant, const Color(0xff03dac6)); + expect(scheme.background, const Color(0xff121212)); + expect(scheme.surface, const Color(0xff121212)); + expect(scheme.error, const Color(0xffcf6679)); + expect(scheme.onPrimary, const Color(0xff000000)); + expect(scheme.onSecondary, const Color(0xff000000)); + expect(scheme.onBackground, const Color(0xffffffff)); + expect(scheme.onSurface, const Color(0xffffffff)); + expect(scheme.onError, const Color(0xff000000)); + expect(scheme.brightness, Brightness.dark); + }); + +} \ No newline at end of file