Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

random color scheme

making a coherent material design theme is hard. this is a flutter plugin that generates a random color pallet based on material design while respecting wcag guidelines.

the idea is for you to (temporarily) replace your colorscheme() with a randomcolorschemelight() or randomcolorschemedark(). on each run, hot refresh or hot restart, the app is going to look different. the theme is printed in terminal, so you can easily copy and paste back into your project with the colors that you want to stay.

the interactive sample allows you to see how it works and the reasoning behind:

sample_preview

usage

in the pubspec.yaml of your flutter project, add the following dependency:

pub package

dependencies:
  random_color_scheme: ^version

in your project, just replace the colorscheme.dark(...) with randomcolorschemedark().
if you want a light theme, there is a randomcolorschemelight().

import 'package:random_colorscheme/random_color_scheme.dart';

theme(
  data: themedata(
    colorscheme: randomcolorschemedark(),
  ),
  child: myapp(),
)

how it works

this started in my color studio project.
i started looking at the material design guidelines on color for both light and dark theme.
after extracting some colors (like the primary, secondary and owl study), i decided to see how similar were they, in what range are they and how they behave together.
then, i used hsluv with a random number generator and rules detected from my observation. the final adjustments were made when tweaking the sample.
hsluv is great because only the lightness attribute affects wcag calculated contrast, so all themes are guaranteed to pass
a minimum accessibility threshold.

function listing

  • randomcolorschemedark(seed: null | int)
  • randomcolorschemelight(seed: null | int)
  • randomcolorscheme(seed: null | int, isdark: bool)

seed: an integer which guarantees the random function is always going to have the same output (i.e., the same colorscheme).
it is optional.


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top