Skip to content

skPaint.setColor throws an error if you pass array of numbers to Skia.Color #2113

Closed
@mobily

Description

Description

Hello! Thank you for this library, I'm having so much fun using it :)

Passing RGBA values to Skia.Color, for example Skia.Color([0, 128, 0, 255]) throws the following error:

CleanShot 2024-01-04 at 11 31 52@2x

I know I can use Float32Array and 0-1 scale:

const skColor = Skia.Color(Float32Array.from([0, 0.9, 0, 1]))
skPaint.setColor(skColor)

However, the Color type suggests I can pass number[] too. I would be grateful for clarification here 🙏

Version

0.1.231

Steps to reproduce

const skPaint = Skia.Paint()
const skColor = Skia.Color([0, 128, 0, 255])

skPaint.setColor(skColor)

Snack, code example, screenshot, or link to a repository

⬆️

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions