Skip to content

Instantly share code, notes, and snippets.

@aliemir
Created December 10, 2019 10:44
Show Gist options
  • Save aliemir/3041139b1b6ccf9ccd5fc59506315e67 to your computer and use it in GitHub Desktop.
Save aliemir/3041139b1b6ccf9ccd5fc59506315e67 to your computer and use it in GitHub Desktop.
Turn every color to MaterialColor for Flutter - Snippet
{
"Custom Color Snippet": {
"prefix": "customcolor",
"body": [
"Map<int, Color> $4 = {",
"\t50:Color.fromRGBO($1, $2, $3, .1),",
"\t100:Color.fromRGBO($1, $2, $3, .2),",
"\t200:Color.fromRGBO($1, $2, $3, .3),",
"\t300:Color.fromRGBO($1, $2, $3, .4),",
"\t400:Color.fromRGBO($1, $2, $3, .5),",
"\t600:Color.fromRGBO($1, $2, $3, .7),",
"\t500:Color.fromRGBO($1, $2, $3, .6),",
"\t700:Color.fromRGBO($1, $2, $3, .8),",
"\t800:Color.fromRGBO($1, $2, $3, .9),",
"\t900:Color.fromRGBO($1, $2, $3, 1)",
"};$0"
],
"description": "Turn any rgb color to material color for flutter"
}
}
@aliemir
Copy link
Author

aliemir commented Dec 10, 2019

Use this and then you can initialize a MaterialColor like

MaterialColor(0xFF00A0F8, $4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment