1

Something like:

getColorShade(Color color){
    
    Color shadeOne = color.shade50
    Color shadeTwo = color.shade300
    Color shadeThree = color.shade500
    
    }

I do not intend to play with the color alpha here.

happyvirus
  • 279
  • 3
  • 21
  • The default colours have shades which you can use like this: `Colors.blue[300];`, but these are hardcoded values. Maybe create a [`HSLColor`](https://api.flutter.dev/flutter/painting/HSLColor-class.html) and adjust the `lightness`? – TmKVU Aug 11 '21 at 14:30
  • Yes, I've used Colors.blue[300] but would like to get shade for any given color. – happyvirus Aug 11 '21 at 14:33
  • 1
    I would try to use `HSLColor` and lightness and try out some values until you get something you like. – TmKVU Aug 11 '21 at 14:51
  • Thanks, will check it out. – happyvirus Aug 11 '21 at 14:52

1 Answers1

0

by using hex color you can use any range of color that you want right? so by getting help from another post here, there is a function which returns a flutter color by sending it a hex number color. here is the function which I use myself:

Color hexToColor(String code) {
  return new Color(int.parse(code.substring(1, 7), radix: 16) + 0xFF000000);
}
Benyamin
  • 1,008
  • 11
  • 18