How to convert 3-digit HTML hex colors to 6-digit flex hex colors

前端 未结 5 394
無奈伤痛
無奈伤痛 2020-12-31 00:43

I want to convert a three-digit hex color which is coming from HTML CSS to a six-digit hex color for Flex. Can anyone give me code to convert 3-digit hex colors to their 6-d

5条回答
  •  既然无缘
    2020-12-31 00:52

    Other answers provided the process but I will provide the code using regex and the java programming language

    String value = "#FFF";
    value = value.replaceAll("#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])", "#$1$1$2$2$3$3");
    

提交回复
热议问题