UiColorScheme

class UiColorScheme(val material: ColorScheme, val mainToolbar: MainToolbarColors = MainToolbarColors(), val settingsColorScheme: SettingsColorScheme = SettingsColorScheme(), val aiAssistantColorScheme: AiAssistantColorScheme = AiAssistantColorScheme(), val documentInfoColorScheme: DocumentInfoColorScheme = DocumentInfoColorScheme(), val tabBar: TabBarColors = TabBarColors(), val outline: OutlineColors = OutlineColors(), val actionMenu: ActionMenuColors = ActionMenuColors(), val contextualToolbar: ContextualToolbarColors = ContextualToolbarColors(), val thumbnailGrid: ThumbnailGridColors = ThumbnailGridColors(), val thumbnailBar: ThumbnailBarColors = ThumbnailBarColors())

The colors of the SDK's UI: a Material 3 material base, and a color scheme per screen that overrides it.

Every slice color defaults to Color.Unspecified and takes its Material role from material when the scheme is resolved, which NutrientTheme does for the scheme it provides. A color documented as defaulting to another color of its slice, such as MainToolbarColors.iconColor, takes that color at resolution too. So a scheme built with fromMaterial themes every screen from the Material roles alone, and a slice only needs the colors that differ. copy() on a slice keeps the others unspecified, so they follow a changed material or sibling color. Call resolve to read the colors a scheme gives outside composition.

Constructors

Link copied to clipboard
constructor(material: ColorScheme, mainToolbar: MainToolbarColors = MainToolbarColors(), settingsColorScheme: SettingsColorScheme = SettingsColorScheme(), aiAssistantColorScheme: AiAssistantColorScheme = AiAssistantColorScheme(), documentInfoColorScheme: DocumentInfoColorScheme = DocumentInfoColorScheme(), tabBar: TabBarColors = TabBarColors(), outline: OutlineColors = OutlineColors(), actionMenu: ActionMenuColors = ActionMenuColors(), contextualToolbar: ContextualToolbarColors = ContextualToolbarColors(), thumbnailGrid: ThumbnailGridColors = ThumbnailGridColors(), thumbnailBar: ThumbnailBarColors = ThumbnailBarColors())
constructor(mainToolbar: MainToolbarColors, settingsColorScheme: SettingsColorScheme, aiAssistantColorScheme: AiAssistantColorScheme, documentInfoColorScheme: DocumentInfoColorScheme)

Creates a scheme from the four slices that predate material, deriving the base from them: the light or dark baseline by the document info background, with the settings' selected color as primary, the document info background and text as background and onSurface, and the main toolbar background as surfaceContainer. The other screens resolve from that base.

constructor(mainToolbar: MainToolbarColors, settingsColorScheme: SettingsColorScheme, aiAssistantColorScheme: AiAssistantColorScheme, documentInfoColorScheme: DocumentInfoColorScheme, tabBar: TabBarColors)

Creates a scheme from the five slices that predate material, deriving the base from them as the four-argument constructor does.

Types

Link copied to clipboard
object Companion

Companion object providing factory methods for UiColorScheme.

Properties

Link copied to clipboard

Color scheme for the action menu, the share sheet. The XML theme's scheme sets it from the pspdf__ActionMenu style.

Link copied to clipboard

Color scheme for the AI assistant UI.

Link copied to clipboard

Color scheme for the contextual toolbars, such as annotation creation. The XML theme's scheme sets it from the pspdf__contextualToolbarStyle style.

Link copied to clipboard

Color scheme for the document info view.

Link copied to clipboard

Color scheme for the main toolbar.

Link copied to clipboard

The Material 3 roles every unspecified slice color resolves to.

Link copied to clipboard

Color scheme for the outline view: its sheet, tab row, and the outline, bookmark, annotation and attachment lists. The XML theme's scheme sets it from the pspdf__OutlineView style.

Link copied to clipboard

Color scheme for settings UI components.

Link copied to clipboard

Color scheme for the document tab bar. The XML theme's scheme sets it from the pspdf__TabBar style.

Link copied to clipboard

Color scheme for the thumbnail bar along the bottom of the document. The XML theme's scheme sets it from the pspdf__thumbnailBarStyle and pspdf__scrollableThumbnailBarStyle styles.

Link copied to clipboard

Color scheme for the thumbnail grid, the page overview. The XML theme's scheme sets it from the pspdf__ThumbnailGrid style.

Functions

Link copied to clipboard
fun copy(material: ColorScheme = this.material, mainToolbar: MainToolbarColors = this.mainToolbar, settingsColorScheme: SettingsColorScheme = this.settingsColorScheme, aiAssistantColorScheme: AiAssistantColorScheme = this.aiAssistantColorScheme, documentInfoColorScheme: DocumentInfoColorScheme = this.documentInfoColorScheme, tabBar: TabBarColors = this.tabBar, outline: OutlineColors = this.outline, actionMenu: ActionMenuColors = this.actionMenu, contextualToolbar: ContextualToolbarColors = this.contextualToolbar, thumbnailGrid: ThumbnailGridColors = this.thumbnailGrid, thumbnailBar: ThumbnailBarColors = this.thumbnailBar): UiColorScheme

Returns a copy with the given base or slices replaced.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Two schemes are equal when their material bases have the same color in every role and their slices are equal.

Link copied to clipboard
open override fun hashCode(): Int

A hash of all the colors, consistent with equals.

Link copied to clipboard

This scheme with every unspecified slice color replaced by its role in material. NutrientTheme provides the resolved scheme, so this is for reading a scheme's colors outside composition.

Link copied to clipboard
open override fun toString(): String

Every color, by property name.

Link copied to clipboard
fun withAccent(accent: Color, onAccent: Color): UiColorScheme

This scheme with one accent: accent becomes primary, primaryContainer, secondaryContainer and inversePrimary in material, with onAccent as the content colors on them, so stock Material 3 components and the colors that resolve to those roles, such as the page grid's ripple, take the accent rather than the old one. Every selection color of every screen follows it: the colors that resolve to those roles, the selected tab and the document info button included, are reset to unspecified, so they keep following material afterwards. The main toolbar's selected icon has no role to follow, it is the toolbar's icon color by default, so it is set to accent outright. Both toolbars keep the selected icon color they had when accent would not read on their bar at 3:1, as on the stock XML theme's colorPrimary toolbar accented with that same color. Everything else is kept, so an XML theme's surfaces and text stay as they are. The AI assistant's reply bubbles and buttons, which would otherwise follow the changed secondaryContainer, are pinned to the tonal colors they had: those four become concrete colors, so replace material before calling this, not after.

fun withAccent(@ColorInt accent: Int, @ColorInt onAccent: Int): UiColorScheme

withAccent with packed ARGB colors, for Java.