Skip to content

Add the palette_generator package to the packages repo - #2

Merged
gspencergoog merged 15 commits into
flutter:masterfrom
gspencergoog:palette_generator
Jul 17, 2018
Merged

gspencergoog merged 15 commits into
flutter:masterfrom
gspencergoog:palette_generator

Conversation

@gspencergoog

@gspencergoog gspencergoog commented Jun 15, 2018 •

Copy link
Copy Markdown
Contributor

This adds a palette generator that will take an image and generate a set of distinct, dominant colors from it. This is more or less a port of the Android Palette class, except that it doesn't automatically resize the image if it is too large.

screenshot_1529385906

Where the first (top left below the image) color is the more prominent distinct color, and the last is the least. It can select various target colors from the available colors based on targets that it is given (and has several default targets it looks for).

The screenshot above is from the sample app that shows how to use it, and lets the user select a region of the image to take the palette from.

[Also, this PR includes the CI PR #1, but I'll merge and resolve that before committing this one.]

@gspencergoog
gspencergoog force-pushed the palette_generator branch 3 times, most recently from eddc4c5 to d055aff Compare June 15, 2018 19:53
@gspencergoog
gspencergoog force-pushed the palette_generator branch 3 times, most recently from be0a65a to 6b14c98 Compare June 19, 2018 05:21
@gspencergoog

ghost commented Jun 19, 2018 •

Copy link
Copy Markdown
Contributor Author

This is ready for review. The people who requested this would like it comitted by Wednesday if at all possible.

@gspencergoog
gspencergoog force-pushed the palette_generator branch 5 times, most recently from 98ad172 to 14f3c9e Compare June 19, 2018 16:52
@lukepighetti

ghost commented Jun 23, 2018 •

Copy link
Copy Markdown

I would have immediate use for this. Glad to see that someone is working on it. :)

screen shot 2018-06-22 at 1 59 21 pm


//import 'package:palette_generator/palette_generator.dart';

//import 'package:flutter/gestures.dart';

ghost Jul 2, 2018

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.

commented out code?

label: 'Light Muted', color: generator.lightMutedColor?.color),
new PaletteSwatch(label: 'Muted', color: generator.mutedColor?.color),
new PaletteSwatch(
label: 'Dark Muted', color: generator.darkMutedColor?.color),

ghost Jul 2, 2018

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.

having some of these wrapped and some not makes this hard to read


/// Returns a muted and dark color from the palette. Might be null if an
/// appropriate target color could not be found.
PaletteColor get darkMutedColor => selectedSwatches[PaletteTarget.darkMuted];

ghost Jul 2, 2018

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.

ditto with the inconsistent wrapping

hslColor.saturation <= target.maximumSaturation &&
hslColor.lightness >= target.minimumLightness &&
hslColor.lightness <= target.maximumLightness &&
!usedColors.contains(paletteColor.color);

ghost Jul 2, 2018

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.

inconsistent indentation

maximumLightness == other.maximumLightness &&
saturationWeight == other.saturationWeight &&
lightnessWeight == other.lightnessWeight &&
populationWeight == other.populationWeight;

ghost Jul 2, 2018

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.

ditto

@Hixie

ghost commented Jul 2, 2018

Copy link
Copy Markdown
Contributor

RSLGTM

@gspencergoog

ghost commented Jul 6, 2018

Copy link
Copy Markdown
Contributor Author

I left the indentation issues because this repo has the dartfmt presubmit check turned on like flutter/plugins does (and so I can't change those without putting in a formatting exception comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants