1
0
mirror of https://github.com/stonega/tsacdop synced 2024-12-16 10:22:23 +01:00
tsacdop-podcast-app-android/lib/util/colorize.dart
stonegate cb5b17bba1 Change audio plugin to just_audio
Add storage setting
Add history setting
2020-03-14 11:14:24 +08:00

31 lines
882 B
Dart

import 'dart:convert';
import 'package:flutter/material.dart';
extension Colorize on String {
Color colorizedark() {
Color _c;
var color = json.decode(this);
if (color[0] > 200 && color[1] > 200 && color[2] > 200) {
_c =
Color.fromRGBO((255 - color[0]), 255 - color[1], 255 - color[2], 1.0);
} else {
_c = Color.fromRGBO(color[0], color[1] > 200 ? 190 : color[1],
color[2] > 200 ? 190 : color[2], 1);
}
return _c;
}
Color colorizeLight() {
Color _c;
var color = json.decode(this);
if (color[0] < 50 && color[1] < 50 && color[2] < 50) {
_c =
Color.fromRGBO((255 - color[0]), 255 - color[1], 255 - color[2], 1.0);
} else {
_c = Color.fromRGBO(color[0] < 50 ? 100 : color[0],
color[1] < 50 ? 100 : color[1], color[2] < 50 ? 100 : color[2], 1.0);
}
return _c;
}
}