类 Colors

java.lang.Object
org.ddr.poi.html.util.Colors

public class Colors extends Object
颜色工具类
从以下版本开始:
2021-02-23
  • 字段详细资料

  • 构造器详细资料

    • Colors

      public Colors()
  • 方法详细资料

    • getColorByName

      public static String getColorByName(String name)
      根据颜色名称获取颜色值,未找到时返回null
      参数:
      name - 颜色名称
      返回:
      颜色值
    • getColorByName

      public static String getColorByName(String name, String defaultColor)
      根据颜色名称获取颜色值,未找到时返回默认颜色值
      参数:
      name - 颜色名称
      defaultColor - 默认颜色值
      返回:
      颜色值
    • fromHSL

      public static String fromHSL(float h, float s, float l)
      hsl颜色转换为颜色值 link
      参数:
      h - hue 0 - 360
      s - saturation 0 - 100
      l - lightness 0 - 100
      返回:
      颜色值
    • fromHWB

      public static String fromHWB(float h, float w, float b)
      hwb颜色转换为颜色值 link
      参数:
      h - hue 0 - 360
      w - whiteness 0 - 100
      b - blackness 0 - 100
      返回:
      颜色值
    • toHexString

      public static String toHexString(int r, int g, int b)
      将RGB转换为颜色值
      参数:
      r - Red
      g - Green
      b - Blue
      返回:
      颜色值
    • fromStyle

      public static String fromStyle(String style, String defaultColor)
      解析样式值为颜色值
      参数:
      style - 样式值
      defaultColor - 默认颜色值
      返回:
      颜色值
    • fromStyle

      public static String fromStyle(String style)
      解析样式值为颜色值,解析失败时返回默认颜色值(黑色)
      参数:
      style - 样式值
      返回:
      颜色值
    • maybe

      public static boolean maybe(String style)
      判断样式值是否可能为颜色
      参数:
      style - 样式值
      返回:
      是否可能为颜色