ColorProperty (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.fo.properties

## Class ColorProperty

- java.lang.Object
- - org.apache.fop.fo.properties.Property
  - - org.apache.fop.fo.properties.ColorProperty

-     public final class ColorProperty
      extends Property

  Class for properties that wrap Color values

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ColorProperty.Maker` Inner class for creating instances of ColorTypeProperty

  - ### Field Summary

    - ### Fields inherited from class org.apache.fop.fo.properties.Property

      `log`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `Color` | `getColor(FOUserAgent foUserAgent)` Returns an AWT instance of this color
    `ColorProperty` | `getColorProperty()` Can't convert to any other types
    `static ColorProperty` | `getInstance(FOUserAgent foUserAgent, String value)` Set the color given a particular String.
    `Object` | `getObject()` This method expects to be overridden by subclasses
    `int` | `hashCode()`
    `String` | `toString()`

    - ### Methods inherited from class org.apache.fop.fo.properties.Property

      `getCharacter, getCondLength, getEnum, getKeep, getLength, getLengthPair, getLengthRange, getList, getNCname, getNumber, getNumeric, getSpace, getSpecifiedValue, getString, isAuto, setSpecifiedValue`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getInstance

          public static ColorProperty getInstance(FOUserAgent foUserAgent,
                                                  String value)
                                           throws PropertyException

      Set the color given a particular String. For a full List of supported values please see ColorUtil.
      Parameters:
        `foUserAgent` - FOP user agent
        `value` - RGB value as String to be parsed
      Returns:
        the canonical ColorProperty instance corresponding to the given value
      Throws:
        `PropertyException` - if the value can't be parsed
      See Also:
        `ColorUtil.parseColorString(FOUserAgent, String)`

    - #### getColor

          public Color getColor(FOUserAgent foUserAgent)

      Returns an AWT instance of this color
      Overrides:
        `getColor` in class `Property`
      Parameters:
        `foUserAgent` - FOP user agent
      Returns:
        float the AWT color represented by this ColorType instance

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Property`

    - #### getColorProperty

          public ColorProperty getColorProperty()

      Can't convert to any other types
      Returns:
        this.colorType

    - #### getObject

          public Object getObject()

      Description copied from class: `Property`
      This method expects to be overridden by subclasses
      Overrides:
        `getObject` in class `Property`
      Returns:
        this.colorType cast as an Object

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2025 Apache Software Foundation. All rights reserved.