Skip to content

Instantly share code, notes, and snippets.

@RobertApikyan
Created July 13, 2023 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertApikyan/f8364df21d88fbc6d65b3fe0e5149c41 to your computer and use it in GitHub Desktop.
Save RobertApikyan/f8364df21d88fbc6d65b3fe0e5149c41 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
// Force unwraps value to non null to avoid force unwrap operator on each call.
class AppColorSwatch<T> extends ColorSwatch<T> {
const AppColorSwatch(super.primary, super.swatch);
@override
Color operator [](T index) => super[index]!;
}
class AppColors {
static const Color transparent = Color(0x00000000);
// static Color get black => pallet.black[50];
static Color get white => black[0];
static const XXF_FFFFFF00 = Color(0xFFFFFF);
static const XXF_81FFFFFF = Color(0x81FFFFFF);
static const neutral = AppColorSwatch<int>(_neutralPrimaryValue, <int, Color>{
0: Color(0xFFf7f5f0),
10: Color(0xFFe6e2d2),
20: Color(0xFFd6cfb4),
30: Color(0xFFc6bc96),
40: Color(0xFFb5a978),
50: Color(0xFFa5965a),
60: Color(0xFF877b4a),
70: Color(0xFF695f39),
80: Color(0xFF4b4429),
90: Color(0xFF2d2919),
100: Color(_neutralPrimaryValue),
});
static const int _neutralPrimaryValue = 0xFF0f0e08;
static const black = AppColorSwatch<int>(_blackPrimary, <int, Color>{
0: Color(0xFFffffff),
10: Color(0xFFe6e6e6),
20: Color(0xFFcccccc),
30: Color(0xFFb3b3b3),
40: Color(0xFF999999),
50: Color(0xFF808080),
60: Color(0xFF666666),
70: Color(0xFF4d4d4d),
80: Color(0xFF333333),
90: Color(0xFF1a1a1a),
100: Color(_blackPrimary),
});
static const int _blackPrimary = 0xFF000000;
static const yellow = AppColorSwatch<int>(_yellowPrimary, <int, Color>{
0: Color(0xFFfffbe8),
10: Color(0xFFfff4b9),
20: Color(0xFFffed8b),
30: Color(0xFFffe65d),
40: Color(0xFFffde2e),
50: Color(_yellowPrimary),
60: Color(0xFFd1b000),
70: Color(0xFFa28900),
80: Color(0xFF746200),
90: Color(0xFF463b00),
100: Color(0xFF171400),
});
static const int _yellowPrimary = 0xFFffd700;
static const red = AppColorSwatch<int>(_redPrimary, <int, Color>{
0: Color(0xFFffe8e8),
10: Color(0xFFffb9b9),
20: Color(0xFFff8b8b),
30: Color(0xFFff5d5d),
40: Color(0xFFff2e2e),
50: Color(_redPrimary),
60: Color(0xFFd10000),
70: Color(0xFFa20000),
80: Color(0xFF740000),
90: Color(0xFF460000),
100: Color(0xFF170000),
});
static const int _redPrimary = 0xFFff0000;
static const blue = AppColorSwatch<int>(_bluePrimary, <int, Color>{
0: Color(0xFFe8f7ff),
10: Color(0xFFb9e8ff),
20: Color(0xFF8bd8ff),
30: Color(0xFF5dc9ff),
40: Color(0xFF2eb9ff),
50: Color(_bluePrimary),
60: Color(0xFF008bd1),
70: Color(0xFF006ca2),
80: Color(0xFF004d74),
90: Color(0xFF002e46),
100: Color(0xFF000f17),
});
static const int _bluePrimary = 0xFF00aaff;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment