Package selection guidance compiled from public package information, community data, and project usage.
A Flutter plugin for macOS that provides access to AppKit’s built-in UI element colors, enabling consistent native appearance across Flutter apps on macOS. It maps system color constants from Apple's AppKit framework, such as window background, control tint, and text colors, ensuring alignment with macOS design guidelines. This package simplifies theming by offering direct access to platform-specific color values without manual configuration.
Use cases
Matching macOS system UI aesthetics
Creating native-looking Flutter apps on macOS
Simplifying theme implementation for macOS
Ensuring consistency with system color schemes
Developing cross-platform apps with macOS-specific styling
Key features
Access to AppKit’s native UI element colors
Seamless integration with macOS Flutter apps
Automatic synchronization with system themes
Minimal setup required
Supports dynamic color updates
Suitable for
Flutter developers targeting macOS
Apps requiring native macOS visual consistency
Designers focused on platform-specific UI fidelity
Projects using macOS-specific theming
Considerations
Limited to macOS platform only
Depends on underlying AppKit availability
May require additional handling for dark mode transitions
Not applicable to non-macOS platforms
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
appkit_ui_element_colors
A Flutter plugin that exposes AppKit’s “UI Element Colors” to facilitate the
retrieval of standard color objects for use with windows, controls, labels, text,
selections and other content in your app.
Each color can be retrieved as a Color object using the AppkitUiElementColors.getColor method:
final darkWindowBackgroundColor = awaitAppkitUiElementColors.getColor(
uiElementColor: UiElementColor.windowBackgroundColor,
appearance: NSAppearanceName.darkAqua,
);
Alternatively, it can also be converted to any available NSColorSpace and retrieved as a map of requested NSColorComponents using AppkitUiElementColors.getColorComponents:
Certain events, such as the user changing their preferred accent color, can trigger system color changes. Such changes can be observed using the SystemColorObserver class. The AppkitUiElementColors class provides a global shared instance of SystemColorObserver that can be accessed as follows:
By default, UiElementColorBuilder uses a
SharedUiElementColorContainerInstanceProvider to provide a global
shared instance of UiElementColorContainer.
SharedUiElementColorContainerInstanceProvider uses an instance of
MediaQueryData derived from the current BuildContext and assumes it to
be the same across all UiElementBuilders which use it.
If your app contains surfaces with different MediaQueryData overrides,
use OwnedUiElementColorContainerInstanceProvider instead:
// A dark cupertino theme.CupertinoTheme(
data: constCupertinoThemeData(
brightness: Brightness.dark,
),
// Override the MediaQueryData so that platformBrightness is dark.
child: MediaQuery(
data: MediaQuery.of(context).copyWith(
platformBrightness: Brightness.dark,
),
child: UiElementColorBuilder(
// Since there may be surfaces within the app that do not override the// brightness, use an OwnedUiElementColorContainerInstanceProvider.
uiElementColorContainerInstanceProvider:
OwnedUiElementColorContainerInstanceProvider(),
builder: (context, colorContainer) => Container(
color: colorContainer.windowBackgroundColor,
),
),
),
);
Incorrect usage of SharedUiElementColorContainerInstanceProvider throws the following assertion error:
“Found conflicting MediaQueryData in SharedUiElementColorContainerInstanceProvider. If you are using UiElementColorBuilder within widget subtrees with differing MediaQueryData (such as different theme brightness or accessibility settings), please use OwnedUiElementColorContainerInstanceProvider instead.”