Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

A Color.fromRGBO #3043

Merged
merged 1 commit into from
Sep 20, 2016
Merged

A Color.fromRGBO #3043

merged 1 commit into from
Sep 20, 2016

Conversation

abarth
Copy link
Contributor

@abarth abarth commented Sep 20, 2016

Sometimes it is convenient to construct a color from an opacity rather than an
alpha value. Unfortunately, this constructor cannot be const because there's no
const way to convert from a double to the internal representation of a Color,
which is an int.

Fixes flutter/flutter#5205

@abarth
Copy link
Contributor Author

abarth commented Sep 20, 2016

@Hixie

/// transparent and 1.0 being fully opaque.
/// * `r` is [red], from 0 to 255.
/// * `g` is [red], from 0 to 255.
/// * `b` is [red], from 0 to 255.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opacity should come last here.

/// transparent and 1.0 being fully opaque.
/// * `r` is [red], from 0 to 255.
/// * `g` is [red], from 0 to 255.
/// * `b` is [red], from 0 to 255.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention that this is the same numbers as CSS rgba()?

/// transparent and 1.0 being fully opaque.
/// * `r` is [red], from 0 to 255.
/// * `g` is [red], from 0 to 255.
/// * `b` is [red], from 0 to 255.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe mention here and in fromARGB that out-of-range values are masked off.

@Hixie
Copy link
Contributor

Hixie commented Sep 20, 2016

LGTM

Sometimes it is convenient to construct a color from an opacity rather than an
alpha value.

Fixes flutter/flutter#5205
@abarth abarth merged commit 1737413 into flutter:master Sep 20, 2016
@abarth abarth deleted the color_from_rgbo branch September 20, 2016 21:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants