src/main/java/de/uapcore/lightpit/types/WebColor.java

changeset 149
30b840ed8c0e
parent 148
87364e7ec333
child 150
822b7e3d064d
     1.1 --- a/src/main/java/de/uapcore/lightpit/types/WebColor.java	Fri Oct 23 18:03:59 2020 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,30 +0,0 @@
     1.4 -package de.uapcore.lightpit.types;
     1.5 -
     1.6 -public final class WebColor {
     1.7 -
     1.8 -    private final String hex;
     1.9 -
    1.10 -    /**
    1.11 -     * Constructs a color object from a hex string.
    1.12 -     * @param hex the 6 digits hex string optionally preceded by a hash symbol
    1.13 -     * @throws IllegalArgumentException if the given string does not specify a color
    1.14 -     */
    1.15 -    public WebColor(String hex) throws IllegalArgumentException {
    1.16 -        this.hex = (hex.startsWith("#") ? hex : ("#"+hex)).toUpperCase();
    1.17 -        if (!this.hex.matches("#[0-9A-F]{6}"))
    1.18 -            throw new IllegalArgumentException(hex+" is not a color");
    1.19 -    }
    1.20 -
    1.21 -    /**
    1.22 -     * Returns the hex representation without th leading hash symbol.
    1.23 -     * @return the hex representation of this color (e.g. FF0000 for red)
    1.24 -     */
    1.25 -    public String getHex() {
    1.26 -        return hex.substring(1);
    1.27 -    }
    1.28 -
    1.29 -    @Override
    1.30 -    public String toString() {
    1.31 -        return hex;
    1.32 -    }
    1.33 -}

mercurial