12345678910111213141516171819202122232425262728293031 |
- import 'package:flutter/material.dart';
- /*
- 颜色统一处理
- * */
- class JXColors {
- // white
- static Color Color_FFFFFF = hexColor(0xFFFFFF);
- static Color Color_F0F0F0 = hexColor(0xF0F0F0);
- static Color Color_E6E6E6 = hexColor(0xE6E6E6);
- static Color Color_747A7E = hexColor(0x747A7E);
- // dark
- static Color Color_2E3032 = hexColor(0x2E3032);
- static Color Color_101E40 = hexColor(0x101E40);
- static Color Color_1F2529 = hexColor(0x1F2529);
- /// 十六进制颜色,
- /// hex, 十六进制值,例如:0xffffff,
- /// alpha, 透明度 [0.0,1.0]
- static Color hexColor(int hex,{double alpha = 1}){
- if (alpha < 0){
- alpha = 0;
- }else if (alpha > 1){
- alpha = 1;
- }
- return Color.fromRGBO((hex & 0xFF0000) >> 16 ,
- (hex & 0x00FF00) >> 8,
- (hex & 0x0000FF) >> 0,
- alpha);
- }
- }
|