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

A Color.fromRGBO - #3043

Merged
abarth merged 1 commit into
flutter-team-archive:masterfrom
abarth:color_from_rgbo
Sep 20, 2016
Merged

abarth merged 1 commit into
flutter-team-archive:masterfrom
abarth:color_from_rgbo

Conversation

@abarth

@abarth abarth commented Sep 20, 2016

Copy link
Copy Markdown
Contributor

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

abarth commented Sep 20, 2016

Copy link
Copy Markdown
Contributor Author

@Hixie

Comment thread lib/ui/painting.dart
/// 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
Copy Markdown
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.

Comment thread lib/ui/painting.dart
/// 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
Copy Markdown
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()?

Comment thread lib/ui/painting.dart
/// 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
Copy Markdown
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

Hixie commented Sep 20, 2016

Copy link
Copy Markdown
Contributor

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-team-archive: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

Development

Successfully merging this pull request may close these issues.

2 participants