# Interface Platform.Preferences

All Superinterfaces:
  `Map<String,Object>`, `Observable`, `ObservableMap<String,Object>`

Enclosing class:
  `Platform`

public static sealed interface Platform.Preferences extends ObservableMap<String,Object>
Contains preferences of the current platform.

`Preferences` extends `ObservableMap` to expose platform preferences as key-value pairs. The map is unmodifiable, which means that keys and values cannot be added, removed, or updated. Calling any mutator method on the map will always cause `UnsupportedOperationException` to be thrown. However, the mappings will be updated by JavaFX when the operating system reports that a platform preference has changed.

For convenience, `getInteger(java.lang.String)`, `getDouble(java.lang.String)`, `getBoolean(java.lang.String)`, `getString(java.lang.String)`, `getColor(java.lang.String)`, and `getValue(java.lang.String, java.lang.Class<T>)` are provided as typed alternatives to the untyped `Map.get(java.lang.Object)` method.

The preferences that are reported by the platform may be dependent on the operating system version and its current configuration, so applications should not assume that a particular preference is always available.

The following preferences are potentially available on the specified platforms:

Windows
`Windows.SPI.HighContrast` | `Boolean`
`Windows.SPI.HighContrastColorScheme` | `String`
`Windows.SPI.ClientAreaAnimation` | `Boolean`
`Windows.SysColor.COLOR_3DFACE` | `Color`
`Windows.SysColor.COLOR_BTNTEXT` | `Color`
`Windows.SysColor.COLOR_GRAYTEXT` | `Color`
`Windows.SysColor.COLOR_HIGHLIGHT` | `Color`
`Windows.SysColor.COLOR_HIGHLIGHTTEXT` | `Color`
`Windows.SysColor.COLOR_HOTLIGHT` | `Color`
`Windows.SysColor.COLOR_WINDOW` | `Color`
`Windows.SysColor.COLOR_WINDOWTEXT` | `Color`
`Windows.UIColor.Background` | `Color`
`Windows.UIColor.Foreground` | `Color`
`Windows.UIColor.AccentDark3` | `Color`
`Windows.UIColor.AccentDark2` | `Color`
`Windows.UIColor.AccentDark1` | `Color`
`Windows.UIColor.Accent` | `Color`
`Windows.UIColor.AccentLight1` | `Color`
`Windows.UIColor.AccentLight2` | `Color`
`Windows.UIColor.AccentLight3` | `Color`
`Windows.UISettings.AdvancedEffectsEnabled` | `Boolean`
`Windows.UISettings.AutoHideScrollBars` | `Boolean`
`Windows.NetworkInformation.InternetCostType` | `String`

macOS
`macOS.NSColor.labelColor` | `Color`
`macOS.NSColor.secondaryLabelColor` | `Color`
`macOS.NSColor.tertiaryLabelColor` | `Color`
`macOS.NSColor.quaternaryLabelColor` | `Color`
`macOS.NSColor.textColor` | `Color`
`macOS.NSColor.placeholderTextColor` | `Color`
`macOS.NSColor.selectedTextColor` | `Color`
`macOS.NSColor.textBackgroundColor` | `Color`
`macOS.NSColor.selectedTextBackgroundColor` | `Color`
`macOS.NSColor.keyboardFocusIndicatorColor` | `Color`
`macOS.NSColor.unemphasizedSelectedTextColor` | `Color`
`macOS.NSColor.unemphasizedSelectedTextBackgroundColor` | `Color`
`macOS.NSColor.linkColor` | `Color`
`macOS.NSColor.separatorColor` | `Color`
`macOS.NSColor.selectedContentBackgroundColor` | `Color`
`macOS.NSColor.unemphasizedSelectedContentBackgroundColor` | `Color`
`macOS.NSColor.selectedMenuItemTextColor` | `Color`
`macOS.NSColor.gridColor` | `Color`
`macOS.NSColor.headerTextColor` | `Color`
`macOS.NSColor.alternatingContentBackgroundColors` | `Color``[]`
`macOS.NSColor.controlAccentColor` | `Color`
`macOS.NSColor.controlColor` | `Color`
`macOS.NSColor.controlBackgroundColor` | `Color`
`macOS.NSColor.controlTextColor` | `Color`
`macOS.NSColor.disabledControlTextColor` | `Color`
`macOS.NSColor.selectedControlColor` | `Color`
`macOS.NSColor.selectedControlTextColor` | `Color`
`macOS.NSColor.alternateSelectedControlTextColor` | `Color`
`macOS.NSColor.currentControlTint` | `String`
`macOS.NSColor.windowBackgroundColor` | `Color`
`macOS.NSColor.windowFrameTextColor` | `Color`
`macOS.NSColor.underPageBackgroundColor` | `Color`
`macOS.NSColor.findHighlightColor` | `Color`
`macOS.NSColor.highlightColor` | `Color`
`macOS.NSColor.shadowColor` | `Color`
`macOS.NSColor.systemBlueColor` | `Color`
`macOS.NSColor.systemBrownColor` | `Color`
`macOS.NSColor.systemGrayColor` | `Color`
`macOS.NSColor.systemGreenColor` | `Color`
`macOS.NSColor.systemIndigoColor` | `Color`
`macOS.NSColor.systemOrangeColor` | `Color`
`macOS.NSColor.systemPinkColor` | `Color`
`macOS.NSColor.systemPurpleColor` | `Color`
`macOS.NSColor.systemRedColor` | `Color`
`macOS.NSColor.systemTealColor` | `Color`
`macOS.NSColor.systemYellowColor` | `Color`
`macOS.NSWorkspace.accessibilityDisplayShouldReduceMotion` | `Boolean`
`macOS.NSWorkspace.accessibilityDisplayShouldReduceTransparency` | `Boolean`
`macOS.NSScroller.preferredScrollerStyle` | `String`
`macOS.NWPathMonitor.currentPathConstrained` | `Boolean`
`macOS.NWPathMonitor.currentPathExpensive` | `Boolean`

Linux
`GTK.theme_name` | `String`
`GTK.theme_fg_color` | `Color`
`GTK.theme_bg_color` | `Color`
`GTK.theme_base_color` | `Color`
`GTK.theme_selected_bg_color` | `Color`
`GTK.theme_selected_fg_color` | `Color`
`GTK.theme_unfocused_fg_color` | `Color`
`GTK.theme_unfocused_bg_color` | `Color`
`GTK.theme_unfocused_base_color` | `Color`
`GTK.theme_unfocused_selected_bg_color` | `Color`
`GTK.theme_unfocused_selected_fg_color` | `Color`
`GTK.insensitive_bg_color` | `Color`
`GTK.insensitive_fg_color` | `Color`
`GTK.insensitive_base_color` | `Color`
`GTK.borders` | `Color`
`GTK.unfocused_borders` | `Color`
`GTK.warning_color` | `Color`
`GTK.error_color` | `Color`
`GTK.success_color` | `Color`
`GTK.enable_animations` | `Boolean`
`GTK.overlay_scrolling` | `Boolean`
`GTK.network_metered` | `Boolean`

Since:
  22

- ## Nested Class Summary

  ### Nested classes/interfaces declared in interface java.util.Map

  `Map.Entry<K,V>`

- ## Property Summary

  Properties
  Type
  Property
  Description
  `ReadOnlyObjectProperty<Color>`
  `accentColor`
  The accent color, which can be used to highlight the active or important part of a control and make it stand out from the rest of the user interface.
  `ReadOnlyObjectProperty<Color>`
  `backgroundColor`
  The color used for background regions.
  `ReadOnlyObjectProperty<ColorScheme>`
  `colorScheme`
  The platform color scheme, which specifies whether applications should prefer light text on dark backgrounds, or dark text on light backgrounds.
  `ReadOnlyObjectProperty<Color>`
  `foregroundColor`
  The color used for foreground elements like text.
  `ReadOnlyBooleanProperty`
  `persistentScrollBars`
  Specifies whether applications should always show scroll bars.
  `ReadOnlyBooleanProperty`
  `reducedData`
  Specifies whether applications should minimize the amount of internet traffic, which users might request because they are on a metered network or a limited data plan.
  `ReadOnlyBooleanProperty`
  `reducedMotion`
  Specifies whether applications should minimize the amount of non-essential animations, reducing discomfort for users who experience motion sickness or vertigo.
  `ReadOnlyBooleanProperty`
  `reducedTransparency`
  Specifies whether applications should minimize the amount of transparent or translucent layer effects, which can help to increase contrast and readability for some users.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ReadOnlyObjectProperty<Color>`
  `accentColorProperty()`
  The accent color, which can be used to highlight the active or important part of a control and make it stand out from the rest of the user interface.
  `ReadOnlyObjectProperty<Color>`
  `backgroundColorProperty()`
  The color used for background regions.
  `ReadOnlyObjectProperty<ColorScheme>`
  `colorSchemeProperty()`
  The platform color scheme, which specifies whether applications should prefer light text on dark backgrounds, or dark text on light backgrounds.
  `ReadOnlyObjectProperty<Color>`
  `foregroundColorProperty()`
  The color used for foreground elements like text.
  `Color`
  `getAccentColor()`
  Gets the value of the `accentColor` property.
  `Color`
  `getBackgroundColor()`
  Gets the value of the `backgroundColor` property.
  `Optional<Boolean>`
  `getBoolean(String key)`
  Returns an optional `Boolean` to which the specified key is mapped.
  `Optional<Color>`
  `getColor(String key)`
  Returns an optional `Color` to which the specified key is mapped.
  `ColorScheme`
  `getColorScheme()`
  Gets the value of the `colorScheme` property.
  `Optional<Double>`
  `getDouble(String key)`
  Returns an optional `Double` to which the specified key is mapped.
  `Color`
  `getForegroundColor()`
  Gets the value of the `foregroundColor` property.
  `Optional<Integer>`
  `getInteger(String key)`
  Returns an optional `Integer` to which the specified key is mapped.
  `Optional<String>`
  `getString(String key)`
  Returns an optional `String` to which the specified key is mapped.
  `<T> Optional<T>`
  `getValue(String key, Class<T> type)`
  Returns an optional value to which the specified key is mapped.
  `boolean`
  `isPersistentScrollBars()`
  Gets the value of the `persistentScrollBars` property.
  `boolean`
  `isReducedData()`
  Gets the value of the `reducedData` property.
  `boolean`
  `isReducedMotion()`
  Gets the value of the `reducedMotion` property.
  `boolean`
  `isReducedTransparency()`
  Gets the value of the `reducedTransparency` property.
  `ReadOnlyBooleanProperty`
  `persistentScrollBarsProperty()`
  Specifies whether applications should always show scroll bars.
  `ReadOnlyBooleanProperty`
  `reducedDataProperty()`
  Specifies whether applications should minimize the amount of internet traffic, which users might request because they are on a metered network or a limited data plan.
  `ReadOnlyBooleanProperty`
  `reducedMotionProperty()`
  Specifies whether applications should minimize the amount of non-essential animations, reducing discomfort for users who experience motion sickness or vertigo.
  `ReadOnlyBooleanProperty`
  `reducedTransparencyProperty()`
  Specifies whether applications should minimize the amount of transparent or translucent layer effects, which can help to increase contrast and readability for some users.

  ### Methods declared in interface java.util.Map

  `clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values`

  ### Methods declared in interface javafx.beans.Observable

  `addListener, removeListener, subscribe`

  ### Methods declared in interface javafx.collections.ObservableMap

  `addListener, removeListener`

- ## Property Details

  - ### persistentScrollBars

    ReadOnlyBooleanProperty persistentScrollBarsProperty
    Specifies whether applications should always show scroll bars. If not set, an application may choose to hide scroll bars that are not actively used, or make them smaller or less noticeable.

    This property corresponds to the `-fx-prefers-persistent-scrollbars` media feature.

    Default value:
      `false`
    Since:
      24
    See Also:
      - `isPersistentScrollBars()`
      - `persistentScrollBarsProperty()`

  - ### reducedMotion

    ReadOnlyBooleanProperty reducedMotionProperty
    Specifies whether applications should minimize the amount of non-essential animations, reducing discomfort for users who experience motion sickness or vertigo.

    This property corresponds to the `prefers-reduced-motion` media feature.

    Default value:
      `false`
    Since:
      24
    See Also:
      - `isReducedMotion()`
      - `reducedMotionProperty()`

  - ### reducedTransparency

    ReadOnlyBooleanProperty reducedTransparencyProperty
    Specifies whether applications should minimize the amount of transparent or translucent layer effects, which can help to increase contrast and readability for some users.

    This property corresponds to the `prefers-reduced-transparency` media feature.

    Default value:
      `false`
    Since:
      24
    See Also:
      - `isReducedTransparency()`
      - `reducedTransparencyProperty()`

  - ### reducedData

    ReadOnlyBooleanProperty reducedDataProperty
    Specifies whether applications should minimize the amount of internet traffic, which users might request because they are on a metered network or a limited data plan.

    This property corresponds to the `prefers-reduced-data` media feature.

    Default value:
      `false`
    Since:
      24
    See Also:
      - `isReducedData()`
      - `reducedDataProperty()`

  - ### colorScheme

    ReadOnlyObjectProperty<ColorScheme> colorSchemeProperty
    The platform color scheme, which specifies whether applications should prefer light text on dark backgrounds, or dark text on light backgrounds.

    This property corresponds to the `prefers-color-scheme` media feature.

    Default value:
      `ColorScheme.LIGHT`
    See Also:
      - `getColorScheme()`
      - `colorSchemeProperty()`

  - ### backgroundColor

    ReadOnlyObjectProperty<Color> backgroundColorProperty
    The color used for background regions.
    Default value:
      `Color.WHITE`
    See Also:
      - `getBackgroundColor()`
      - `backgroundColorProperty()`

  - ### foregroundColor

    ReadOnlyObjectProperty<Color> foregroundColorProperty
    The color used for foreground elements like text.
    Default value:
      `Color.BLACK`
    See Also:
      - `getForegroundColor()`
      - `foregroundColorProperty()`

  - ### accentColor

    ReadOnlyObjectProperty<Color> accentColorProperty
    The accent color, which can be used to highlight the active or important part of a control and make it stand out from the rest of the user interface. It is usually a vivid color that contrasts with the foreground and background colors.
    Default value:
      `#157EFB`
    See Also:
      - `getAccentColor()`
      - `accentColorProperty()`

- ## Method Details

  - ### persistentScrollBarsProperty

    ReadOnlyBooleanProperty persistentScrollBarsProperty()
    Specifies whether applications should always show scroll bars. If not set, an application may choose to hide scroll bars that are not actively used, or make them smaller or less noticeable.

    This property corresponds to the `-fx-prefers-persistent-scrollbars` media feature.

    Default value:
      `false`
    Returns:
      the `persistentScrollBars` property
    Since:
      24
    See Also:
      - `isPersistentScrollBars()`

  - ### isPersistentScrollBars

    boolean isPersistentScrollBars()
    Gets the value of the `persistentScrollBars` property.
    Property description:
      Specifies whether applications should always show scroll bars. If not set, an application may choose to hide scroll bars that are not actively used, or make them smaller or less noticeable.

      This property corresponds to the `-fx-prefers-persistent-scrollbars` media feature.

    Default value:
      `false`
    Returns:
      the value of the `persistentScrollBars` property
    Since:
      24
    See Also:
      - `persistentScrollBarsProperty()`

  - ### reducedMotionProperty

    ReadOnlyBooleanProperty reducedMotionProperty()
    Specifies whether applications should minimize the amount of non-essential animations, reducing discomfort for users who experience motion sickness or vertigo.

    This property corresponds to the `prefers-reduced-motion` media feature.

    Default value:
      `false`
    Returns:
      the `reducedMotion` property
    Since:
      24
    See Also:
      - `isReducedMotion()`

  - ### isReducedMotion

    boolean isReducedMotion()
    Gets the value of the `reducedMotion` property.
    Property description:
      Specifies whether applications should minimize the amount of non-essential animations, reducing discomfort for users who experience motion sickness or vertigo.

      This property corresponds to the `prefers-reduced-motion` media feature.

    Default value:
      `false`
    Returns:
      the value of the `reducedMotion` property
    Since:
      24
    See Also:
      - `reducedMotionProperty()`

  - ### reducedTransparencyProperty

    ReadOnlyBooleanProperty reducedTransparencyProperty()
    Specifies whether applications should minimize the amount of transparent or translucent layer effects, which can help to increase contrast and readability for some users.

    This property corresponds to the `prefers-reduced-transparency` media feature.

    Default value:
      `false`
    Returns:
      the `reducedTransparency` property
    Since:
      24
    See Also:
      - `isReducedTransparency()`

  - ### isReducedTransparency

    boolean isReducedTransparency()
    Gets the value of the `reducedTransparency` property.
    Property description:
      Specifies whether applications should minimize the amount of transparent or translucent layer effects, which can help to increase contrast and readability for some users.

      This property corresponds to the `prefers-reduced-transparency` media feature.

    Default value:
      `false`
    Returns:
      the value of the `reducedTransparency` property
    Since:
      24
    See Also:
      - `reducedTransparencyProperty()`

  - ### reducedDataProperty

    ReadOnlyBooleanProperty reducedDataProperty()
    Specifies whether applications should minimize the amount of internet traffic, which users might request because they are on a metered network or a limited data plan.

    This property corresponds to the `prefers-reduced-data` media feature.

    Default value:
      `false`
    Returns:
      the `reducedData` property
    Since:
      24
    See Also:
      - `isReducedData()`

  - ### isReducedData

    boolean isReducedData()
    Gets the value of the `reducedData` property.
    Property description:
      Specifies whether applications should minimize the amount of internet traffic, which users might request because they are on a metered network or a limited data plan.

      This property corresponds to the `prefers-reduced-data` media feature.

    Default value:
      `false`
    Returns:
      the value of the `reducedData` property
    Since:
      24
    See Also:
      - `reducedDataProperty()`

  - ### colorSchemeProperty

    ReadOnlyObjectProperty<ColorScheme> colorSchemeProperty()
    The platform color scheme, which specifies whether applications should prefer light text on dark backgrounds, or dark text on light backgrounds.

    This property corresponds to the `prefers-color-scheme` media feature.

    Default value:
      `ColorScheme.LIGHT`
    Returns:
      the `colorScheme` property
    See Also:
      - `getColorScheme()`

  - ### getColorScheme

    ColorScheme getColorScheme()
    Gets the value of the `colorScheme` property.
    Property description:
      The platform color scheme, which specifies whether applications should prefer light text on dark backgrounds, or dark text on light backgrounds.

      This property corresponds to the `prefers-color-scheme` media feature.

    Default value:
      `ColorScheme.LIGHT`
    Returns:
      the value of the `colorScheme` property
    See Also:
      - `colorSchemeProperty()`

  - ### backgroundColorProperty

    ReadOnlyObjectProperty<Color> backgroundColorProperty()
    The color used for background regions.
    Default value:
      `Color.WHITE`
    Returns:
      the `backgroundColor` property
    See Also:
      - `getBackgroundColor()`

  - ### getBackgroundColor

    Color getBackgroundColor()
    Gets the value of the `backgroundColor` property.
    Property description:
      The color used for background regions.
    Default value:
      `Color.WHITE`
    Returns:
      the value of the `backgroundColor` property
    See Also:
      - `backgroundColorProperty()`

  - ### foregroundColorProperty

    ReadOnlyObjectProperty<Color> foregroundColorProperty()
    The color used for foreground elements like text.
    Default value:
      `Color.BLACK`
    Returns:
      the `foregroundColor` property
    See Also:
      - `getForegroundColor()`

  - ### getForegroundColor

    Color getForegroundColor()
    Gets the value of the `foregroundColor` property.
    Property description:
      The color used for foreground elements like text.
    Default value:
      `Color.BLACK`
    Returns:
      the value of the `foregroundColor` property
    See Also:
      - `foregroundColorProperty()`

  - ### accentColorProperty

    ReadOnlyObjectProperty<Color> accentColorProperty()
    The accent color, which can be used to highlight the active or important part of a control and make it stand out from the rest of the user interface. It is usually a vivid color that contrasts with the foreground and background colors.
    Default value:
      `#157EFB`
    Returns:
      the `accentColor` property
    See Also:
      - `getAccentColor()`

  - ### getAccentColor

    Color getAccentColor()
    Gets the value of the `accentColor` property.
    Property description:
      The accent color, which can be used to highlight the active or important part of a control and make it stand out from the rest of the user interface. It is usually a vivid color that contrasts with the foreground and background colors.
    Default value:
      `#157EFB`
    Returns:
      the value of the `accentColor` property
    See Also:
      - `accentColorProperty()`

  - ### getInteger

    Optional<Integer> getInteger(String key)
    Returns an optional `Integer` to which the specified key is mapped.
    Parameters:
      `key` - the key
    Returns:
      the optional `Integer` to which the key is mapped
    Throws:
      `NullPointerException` - if `key` is null
      `IllegalArgumentException` - if the key is not mappable to an `Integer`

  - ### getDouble

    Optional<Double> getDouble(String key)
    Returns an optional `Double` to which the specified key is mapped.
    Parameters:
      `key` - the key
    Returns:
      the optional `Double` to which the key is mapped
    Throws:
      `NullPointerException` - if `key` is null
      `IllegalArgumentException` - if the key is not mappable to a `Double`

  - ### getBoolean

    Optional<Boolean> getBoolean(String key)
    Returns an optional `Boolean` to which the specified key is mapped.
    Parameters:
      `key` - the key
    Returns:
      the optional `Boolean` to which the key is mapped
    Throws:
      `NullPointerException` - if `key` is null
      `IllegalArgumentException` - if the key is not mappable to a `Boolean`

  - ### getString

    Optional<String> getString(String key)
    Returns an optional `String` to which the specified key is mapped.
    Parameters:
      `key` - the key
    Returns:
      the optional `String` to which the key is mapped
    Throws:
      `NullPointerException` - if `key` is null
      `IllegalArgumentException` - if the key is not mappable to a `String`

  - ### getColor

    Optional<Color> getColor(String key)
    Returns an optional `Color` to which the specified key is mapped.
    Parameters:
      `key` - the key
    Returns:
      the optional `Color` instance to which the key is mapped
    Throws:
      `NullPointerException` - if `key` is null
      `IllegalArgumentException` - if the key is not mappable to a `Color`

  - ### getValue

    <T> Optional<T> getValue(String key, Class<T> type)
    Returns an optional value to which the specified key is mapped.
    Type Parameters:
      `T` - the type of the value
    Parameters:
      `key` - the key
      `type` - the type of the value
    Returns:
      the optional value to which the key is mapped
    Throws:
      `NullPointerException` - if `key` or `type` is null
      `IllegalArgumentException` - if the key is not mappable to a value of type `T`