Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@ updates:
actions:
patterns:
- "*"

# The documentation site's build, pinned in requirements-docs.txt.
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 5
67 changes: 67 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Docs

# Builds the documentation site from docs/ on every change to it, and publishes it to GitHub Pages from master.
# A pull request gets the build alone, so a broken link or a missing page fails it before it can reach the site.
on:
push:
branches: [ master ]
paths: &docs-paths
- 'docs/**'
- 'docs-overrides/**'
- 'mkdocs.yml'
- 'requirements-docs.txt'
- 'scripts/docs-llms-txt.py'
- '.github/workflows/docs.yml'
pull_request:
paths: *docs-paths
workflow_dispatch:

# Least privilege: building only reads the repo. The deploy job alone may write to Pages.
permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
concurrency:
group: docs-build-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.15'
cache: 'pip'
cache-dependency-path: requirements-docs.txt
- name: Install the site's build
run: pip install -r requirements-docs.txt
# --strict fails on a link to a page, image or heading that does not exist.
- name: Build the site
run: zensical build --strict --config-file mkdocs.yml
- name: Write llms.txt
run: python scripts/docs-llms-txt.py site
- name: Upload the site for Pages
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v5
with:
path: site

deploy:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# One deployment at a time, and never cancelled halfway: a newer push queues behind it.
concurrency:
group: pages
cancel-in-progress: false
steps:
- id: deployment
uses: actions/deploy-pages@v5
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ build/
.claude/
.kotlin/
/tools/reference/node_modules/
# The documentation site's build output and cache (mkdocs.yml)
/site/
/.cache/
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Note that `gradle/gradle-daemon-jvm.properties` is generated by the `updateDaemo

## Documentation

The README is the overview. The details are on [the docs site](https://side-codes.github.io/anyColorPicker/), which GitHub Pages builds from `docs/`, one page per topic. A page's front matter gives its `title`, its `description` (the snippet a search result shows, under 160 characters), and its `section` and `nav_order`, which place it in the navigation at the foot of every page and in `llms.txt`. Pages link to each other by file name (`[Theming](theming.md)`); the README links to the site. The version in the README's and the pages' `implementation(…)` lines is written out, so a release updates it there too.
The README is the overview. The details are on [the docs site](https://side-codes.github.io/anyColorPicker/), one page per topic in `docs/`, which [Zensical](https://zensical.org/) builds with `mkdocs.yml` and `docs.yml` publishes to GitHub Pages from `master`; a pull request that touches the docs gets a build that fails on any broken link. A page's front matter gives its `title`, its `description` (the snippet a search result shows, under 160 characters) and the `icon` beside it in the sidebar. Its place in the sidebar, and in `llms.txt`, is its line in `mkdocs.yml`'s `nav`. Pages link to each other by file name (`[Theming](theming.md)`); the README links to the site. To preview the site, `pip install -r requirements-docs.txt` and run `zensical serve`. The version in the README's and the pages' `implementation(…)` lines is written out, so a release updates it there too.

## Release process

Expand Down
14 changes: 14 additions & 0 deletions docs-overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{#- The theme writes each page's title, description and canonical address; this adds the tags link previews read. -#}
{% extends "base.html" %}

{% block extrahead %}
{%- set title = page.meta.title if page.meta and page.meta.title else config.site_name -%}
{%- set description = page.meta.description if page.meta and page.meta.description else config.site_description -%}
<meta property="og:type" content="website">
<meta property="og:site_name" content="{{ config.site_name }}">
<meta property="og:title" content="{{ title }}">
<meta property="og:description" content="{{ description }}">
<meta property="og:url" content="{{ page.canonical_url }}">
<meta property="og:image" content="{{ config.site_url }}images/social-preview.png">
<meta name="twitter:card" content="summary_large_image">
{% endblock %}
13 changes: 0 additions & 13 deletions docs/_config.yml

This file was deleted.

16 changes: 0 additions & 16 deletions docs/_includes/docs-nav.html

This file was deleted.

8 changes: 0 additions & 8 deletions docs/_layouts/page.html

This file was deleted.

3 changes: 1 addition & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Architecture: a value stays in its space"
description: "Why anyColorPicker keeps a color in the space it was written in and converts forward only, as CSS Color 4, color.js and Sass do, so edits never lose precision."
section: State and architecture
nav_order: 170
icon: material/sitemap-outline
---

Color space conversions lose precision: floats round, and a conversion cannot invent what a
Expand Down
3 changes: 1 addition & 2 deletions docs/color-model.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "The color model"
description: "How anyColorPicker holds a color in Kotlin: a ColorValue in one color space, in CSS Color 4 units, with none components, your own spaces and Compose colors."
section: Colors
nav_order: 30
icon: material/cube-outline
---

A `ColorValue` is a color in one space: that space's components, in its own units, and an alpha.
Expand Down
3 changes: 1 addition & 2 deletions docs/color-spaces.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Choosing a color space"
description: "Which color space to pick in with anyColorPicker, and what each is for: Okhsl, Okhsv, Oklab, OkLCh, Lab, LCH, HSL, HWB, HSV, CMYK, sRGB, Display P3 and XYZ."
section: Colors
nav_order: 40
icon: material/palette-outline
---

- **Okhsl** is Björn Ottosson's perceptual replacement for HSL, and the one to reach for if you
Expand Down
3 changes: 1 addition & 2 deletions docs/color-swatch.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Color swatch"
description: "ColorSwatch in anyColorPicker draws a Compose color over a transparency checkerboard, so a color's alpha reads correctly."
section: Components
nav_order: 110
icon: material/checkerboard
---

`ColorSwatch` draws the color over a transparency checkerboard, so alpha reads correctly:
Expand Down
3 changes: 1 addition & 2 deletions docs/css-and-hex.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "CSS color strings and hex"
description: "Write and parse CSS Color 4 strings and hex colors in Kotlin with anyColorPicker, and choose which end of an eight-digit hex holds the alpha."
section: Colors
nav_order: 60
icon: material/pound
---

## CSS color strings
Expand Down
3 changes: 1 addition & 2 deletions docs/custom-thumb.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Custom slider thumb"
description: "Replace the Material 3 slider thumb in anyColorPicker with your own Compose thumb that reacts to press and drag, and size the track gap with thumbWidth."
section: Components
nav_order: 100
icon: material/radiobox-marked
---

Every slider takes a `thumb` slot, so the Material 3 thumb can be replaced outright — its
Expand Down
3 changes: 1 addition & 2 deletions docs/dialog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Color picker dialog"
description: "ColorPickerDialog: a Material 3 color picker dialog for Compose that shows the original color beside the new one and switches between color spaces."
section: Components
nav_order: 120
icon: material/dock-window
---

A Material 3 `AlertDialog`: the original color beside the one being edited, with its hex, a
Expand Down
3 changes: 1 addition & 2 deletions docs/gallery.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Gallery of color pickers"
description: "Screenshots of every anyColorPicker color picker: RGB, HSL, HSV, HWB, Lab, LCH, Oklab, OkLCh, Okhsl, Okhsv and CMYK, in both coloring modes."
section: Get started
nav_order: 20
icon: material/view-gallery-outline
---

Every picker takes a `ColoringMode`. `Independent` shows each channel's full range;
Expand Down
3 changes: 1 addition & 2 deletions docs/gamut-mapping.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Gamut mapping"
description: "How anyColorPicker draws a color outside sRGB with CSS Color 4 gamut mapping, holding lightness and hue within a just-noticeable difference."
section: Colors
nav_order: 50
icon: material/vector-triangle
---

Drawing a color outside sRGB does not clamp each channel independently, which would shift
Expand Down
Binary file added docs/images/channel-sliders.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/localization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/theming.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/without-material.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
title: "Color picker for Compose Multiplatform and Jetpack Compose"
description: "A Kotlin Multiplatform color picker for Compose Multiplatform and Jetpack Compose on Android, iOS, desktop and web: Material 3 pickers, or your own design."
icon: material/home-outline
---

# Color picker for Compose Multiplatform and Jetpack Compose

anyColorPicker is a color picker library for Kotlin Multiplatform and Compose Multiplatform, on Android, iOS, desktop (JVM) and the web (Wasm): ready-made Material 3 pickers, and the same pickers without Material for a design system of your own. On Android it is a Jetpack Compose color picker: an Android-only app adds one dependency and needs no Kotlin Multiplatform setup.

> **This documentation describes 2.0.** 1.x is documented at the [v1.2.0 tag](https://github.com/side-codes/anyColorPicker/tree/v1.2.0#readme), and [Migrating from 1.x](migrating-from-1x.md) maps one API onto the other.
Expand Down Expand Up @@ -89,4 +92,4 @@ HslColorPicker(color = color, onColorChange = { color = it })
```

The source, issues and releases are on [GitHub](https://github.com/side-codes/anyColorPicker), under the
Apache License 2.0. Each page of this documentation is listed below.
Apache License 2.0.
15 changes: 0 additions & 15 deletions docs/llms.txt

This file was deleted.

9 changes: 7 additions & 2 deletions docs/localization.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Localization, words and numbers"
description: "Translate or reword every label and screen reader announcement in anyColorPicker with ColorPickerStrings, with numbers in the device's locale format."
section: Components
nav_order: 130
icon: material/translate
---

Every label, spoken description and value the components show comes from `ColorPickerStrings`:
Expand Down Expand Up @@ -34,3 +33,9 @@ keeps them. A string passed to a component still wins over the provided ones.

Every component supports right-to-left layouts except the
[color planes](planes.md), which map a color space rather than showing progress.

An HSL picker in Egyptian Arabic, in an app with no strings of its own: the numbers in Arabic-Indic
digits, the sliders running from the right, the plane as in any other language, and the words the
library's English.

![HSL color picker in Egyptian Arabic, right to left, with its values in Arabic-Indic digits](images/localization.png){ width="440" }
3 changes: 1 addition & 2 deletions docs/migrating-from-1x.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Migrating from 1.x"
description: "Move an app from anyColorPicker 1.x to 2.0, declaration by declaration: coordinates, packages, color classes, state, sliders, planes, slots and the dialog."
section: Guides
nav_order: 190
icon: material/arrow-up-bold-circle-outline
---

2.0 replaces 1.x's color classes with `ColorValue` and its per-channel components with ones that
Expand Down
3 changes: 1 addition & 2 deletions docs/migrating-from-andcolorpicker.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Migrating from andcolorpicker"
description: "Move from the discontinued View-based andcolorpicker 0.6.x Android library to anyColorPicker's Jetpack Compose components, concept by concept."
section: Guides
nav_order: 200
icon: material/swap-horizontal
---

The View-based `codes.side:andcolorpicker` artifact (XML `HSLColorPickerSeekBar` and friends) is discontinued. This library is a full Compose Multiplatform rewrite published under new coordinates:
Expand Down
3 changes: 1 addition & 2 deletions docs/pickers.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Color pickers"
description: "The anyColorPicker Compose color pickers: ColorPicker in any color space, the eleven named pickers, slots, layout, and controlled ColorValue and Color forms."
section: Components
nav_order: 70
icon: material/eyedropper-variant
---

```kotlin
Expand Down
3 changes: 1 addition & 2 deletions docs/planes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Color planes"
description: "ChannelPlane in anyColorPicker picks two channels of a color space at once: HSL, Okhsl and Okhsv planes, rendering, keyboard and screen reader access."
section: Components
nav_order: 90
icon: material/gradient-horizontal
---

`ChannelPlane(state, x, y)` picks two channels of one space at once, holding the space's others,
Expand Down
3 changes: 1 addition & 2 deletions docs/samples.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Running the samples"
description: "Run the anyColorPicker sample app on desktop, Android and iOS from the repository with Gradle."
section: Guides
nav_order: 180
icon: material/play-circle-outline
---

The same sample app runs on every supported platform:
Expand Down
3 changes: 1 addition & 2 deletions docs/setup.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Setup and requirements"
description: "Add anyColorPicker to a Jetpack Compose Android app or a Kotlin Multiplatform project from Maven Central: the artifacts, published targets and requirements."
section: Get started
nav_order: 10
icon: material/package-variant-closed
---

anyColorPicker is published on Maven Central. For the Material 3 pickers:
Expand Down
5 changes: 3 additions & 2 deletions docs/sliders.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "Channel sliders"
description: "ChannelSlider and AlphaSlider in anyColorPicker: a Compose slider for one channel of any color space, with keyboard, screen reader and label support."
section: Components
nav_order: 80
icon: material/tune-variant
---

`ChannelSlider(state, channel)` is a slider for one channel of any space, and `AlphaSlider(state)`
Expand All @@ -16,6 +15,8 @@ ChannelSlider(state, Srgb.R)
AlphaSlider(state)
```

![Okhsl hue, OkLCh chroma over its full range and over 0 to 0.2, sRGB red and alpha sliders](images/channel-sliders.png){ width="440" }

- The thumb sits at the channel's displayed value, so a grey's hue slider shows the hue last
chosen. A value outside `range`, such as OkLCh chroma 0.5 or extended sRGB, pins the thumb to
that end while the label keeps its true number; it changes only when the user moves the slider.
Expand Down
3 changes: 1 addition & 2 deletions docs/state.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: "State management"
description: "ColorPickerState holds the color a Compose picker edits, remembers a grey's hue, reads any channel in any space, and survives process death."
section: State and architecture
nav_order: 160
icon: material/state-machine
---

`ColorPickerState` holds the color a picker edits, as one `ColorValue`, and the hues it
Expand Down
Loading
Loading