Skip to content

Commit

Permalink
Show fallback vs P3 in range
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Oct 3, 2024
1 parent 36cd239 commit 24edca2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions view/range/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
canvasFormat,
fastFormat,
generateGetSpace,
Space
Space,
toRgb
} from '../../lib/colors.js'
import { getBorders } from '../../lib/dom.js'
import {
Expand Down Expand Up @@ -70,10 +71,15 @@ function paint(
let space = getSpace(color)
if (space !== Space.Out) {
ctx.fillStyle = canvasFormat(color)
ctx.fillRect(x, 0, 1, height)
if (space !== Space.sRGB) {
ctx.fillRect(x, halfHeight, 1, halfHeight)
ctx.fillStyle = space === Space.P3 ? borderP3 : borderRec2020
ctx.fillRect(x, halfHeight, 1, 1)
let fallback = toRgb(color)
ctx.fillStyle = fastFormat(fallback)
ctx.fillRect(x, 0, 1, halfHeight)
} else {
ctx.fillRect(x, 0, 1, height)
}
if (prevSpace !== space) {
if (
Expand Down

0 comments on commit 24edca2

Please sign in to comment.