INNER CODE UNIT · Dart

intToHex

Ephenodrom/Dart-Basic-Utils · lib/src/ColorUtils.dart:32

  static String intToHex(int i) {
    assert(i >= 0 && i <= 0xFFFFFFFF);
    return '#${(i & 0xFFFFFF | 0x1000000).toRadixString(16).substring(1).toUpperCase()}';
  }

  ///
  /// Lightens or darkens the given [hex] color by the given [percent].
  ///
  /// To lighten a color, set the [percent] value to > 0.
  /// To darken a color, set the [percent] value to < 0.
  /// Will add a # to the [hex] string if it is missing.
  ///
  ///
  static String shadeColor(String hex, double percent) {
    var bC = basicColorsFromHex(hex);

    var R = (bC[BASIC_COLOR_RED]! * (100 + percent) / 100).round();
    var G = (bC[BASIC_COLOR_GREEN]! * (100 + percent) / 100).round();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…