Skip to content

setAlpha and setOpacity have no effect #14

@nfriend

Description

@nfriend

Summary

The setAlpha and setOpacity methods don't seem to have any effect on the TinyColor instance.

Possible cause

Looking at the source, I believe this is because these methods are defined like this:

TinyColor setAlpha(int alpha) {
  _color.withAlpha(alpha);
  return this;
}

However, the withAlpha method returns a new Color instance:

Returns a new color that matches this color with the alpha channel replaced with a (which ranges from 0 to 255).

so this doesn't actually change _color.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions