Skip to content

Commit

Permalink
Better color icons (flutter#871)
Browse files Browse the repository at this point in the history
* commit repo file

* display a color icon for primary colors
  • Loading branch information
devoncarew authored Apr 3, 2017
1 parent 75af0c8 commit 89f1eb1
Show file tree
Hide file tree
Showing 7 changed files with 700 additions and 411 deletions.
35 changes: 35 additions & 0 deletions resources/flutter/colors.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ white12=1fffffff
white10=1affffff

# primaries
grey.primary=ff9e9e9e
grey[50]=fffafafa
grey[100]=fff5f5f5
grey[200]=ffeeeeee
Expand All @@ -30,6 +31,7 @@ grey[700]=ff616161
grey[800]=ff424242
grey[850]=ff303030
grey[900]=ff212121
red.primary=fff44336
red[50]=ffffebee
red[100]=ffffcdd2
red[200]=ffef9a9a
Expand All @@ -40,6 +42,7 @@ red[600]=ffe53935
red[700]=ffd32f2f
red[800]=ffc62828
red[900]=ffb71c1c
pink.primary=ffe91e63
pink[50]=fffce4ec
pink[100]=fff8bbd0
pink[200]=fff48fb1
Expand All @@ -50,6 +53,7 @@ pink[600]=ffd81b60
pink[700]=ffc2185b
pink[800]=ffad1457
pink[900]=ff880e4f
purple.primary=ff9c27b0
purple[50]=fff3e5f5
purple[100]=ffe1bee7
purple[200]=ffce93d8
Expand All @@ -60,6 +64,7 @@ purple[600]=ff8e24aa
purple[700]=ff7b1fa2
purple[800]=ff6a1b9a
purple[900]=ff4a148c
deepPurple.primary=ff673ab7
deepPurple[50]=ffede7f6
deepPurple[100]=ffd1c4e9
deepPurple[200]=ffb39ddb
Expand All @@ -70,6 +75,7 @@ deepPurple[600]=ff5e35b1
deepPurple[700]=ff512da8
deepPurple[800]=ff4527a0
deepPurple[900]=ff311b92
indigo.primary=ff3f51b5
indigo[50]=ffe8eaf6
indigo[100]=ffc5cae9
indigo[200]=ff9fa8da
Expand All @@ -80,6 +86,7 @@ indigo[600]=ff3949ab
indigo[700]=ff303f9f
indigo[800]=ff283593
indigo[900]=ff1a237e
blue.primary=ff2196f3
blue[50]=ffe3f2fd
blue[100]=ffbbdefb
blue[200]=ff90caf9
Expand All @@ -90,6 +97,7 @@ blue[600]=ff1e88e5
blue[700]=ff1976d2
blue[800]=ff1565c0
blue[900]=ff0d47a1
lightBlue.primary=ff03a9f4
lightBlue[50]=ffe1f5fe
lightBlue[100]=ffb3e5fc
lightBlue[200]=ff81d4fa
Expand All @@ -100,6 +108,7 @@ lightBlue[600]=ff039be5
lightBlue[700]=ff0288d1
lightBlue[800]=ff0277bd
lightBlue[900]=ff01579b
cyan.primary=ff00bcd4
cyan[50]=ffe0f7fa
cyan[100]=ffb2ebf2
cyan[200]=ff80deea
Expand All @@ -110,6 +119,7 @@ cyan[600]=ff00acc1
cyan[700]=ff0097a7
cyan[800]=ff00838f
cyan[900]=ff006064
teal.primary=ff009688
teal[50]=ffe0f2f1
teal[100]=ffb2dfdb
teal[200]=ff80cbc4
Expand All @@ -120,6 +130,7 @@ teal[600]=ff00897b
teal[700]=ff00796b
teal[800]=ff00695c
teal[900]=ff004d40
green.primary=ff4caf50
green[50]=ffe8f5e9
green[100]=ffc8e6c9
green[200]=ffa5d6a7
Expand All @@ -130,6 +141,7 @@ green[600]=ff43a047
green[700]=ff388e3c
green[800]=ff2e7d32
green[900]=ff1b5e20
lightGreen.primary=ff8bc34a
lightGreen[50]=fff1f8e9
lightGreen[100]=ffdcedc8
lightGreen[200]=ffc5e1a5
Expand All @@ -140,6 +152,7 @@ lightGreen[600]=ff7cb342
lightGreen[700]=ff689f38
lightGreen[800]=ff558b2f
lightGreen[900]=ff33691e
lime.primary=ffcddc39
lime[50]=fff9fbe7
lime[100]=fff0f4c3
lime[200]=ffe6ee9c
Expand All @@ -150,6 +163,7 @@ lime[600]=ffc0ca33
lime[700]=ffafb42b
lime[800]=ff9e9d24
lime[900]=ff827717
yellow.primary=ffffeb3b
yellow[50]=fffffde7
yellow[100]=fffff9c4
yellow[200]=fffff59d
Expand All @@ -160,6 +174,7 @@ yellow[600]=fffdd835
yellow[700]=fffbc02d
yellow[800]=fff9a825
yellow[900]=fff57f17
amber.primary=ffffc107
amber[50]=fffff8e1
amber[100]=ffffecb3
amber[200]=ffffe082
Expand All @@ -170,6 +185,7 @@ amber[600]=ffffb300
amber[700]=ffffa000
amber[800]=ffff8f00
amber[900]=ffff6f00
orange.primary=ffff9800
orange[50]=fffff3e0
orange[100]=ffffe0b2
orange[200]=ffffcc80
Expand All @@ -180,6 +196,7 @@ orange[600]=fffb8c00
orange[700]=fff57c00
orange[800]=ffef6c00
orange[900]=ffe65100
deepOrange.primary=ffff5722
deepOrange[50]=fffbe9e7
deepOrange[100]=ffffccbc
deepOrange[200]=ffffab91
Expand All @@ -190,6 +207,7 @@ deepOrange[600]=fff4511e
deepOrange[700]=ffe64a19
deepOrange[800]=ffd84315
deepOrange[900]=ffbf360c
brown.primary=ff795548
brown[50]=ffefebe9
brown[100]=ffd7ccc8
brown[200]=ffbcaaa4
Expand All @@ -200,6 +218,7 @@ brown[600]=ff6d4c41
brown[700]=ff5d4037
brown[800]=ff4e342e
brown[900]=ff3e2723
blueGrey.primary=ff607d8b
blueGrey[50]=ffeceff1
blueGrey[100]=ffcfd8dc
blueGrey[200]=ffb0bec5
Expand All @@ -212,66 +231,82 @@ blueGrey[800]=ff37474f
blueGrey[900]=ff263238

# accents
redAccent.primary=ffff5252
redAccent[100]=ffff8a80
redAccent[200]=ffff5252
redAccent[400]=ffff1744
redAccent[700]=ffd50000
pinkAccent.primary=ffff4081
pinkAccent[100]=ffff80ab
pinkAccent[200]=ffff4081
pinkAccent[400]=fff50057
pinkAccent[700]=ffc51162
purpleAccent.primary=ffe040fb
purpleAccent[100]=ffea80fc
purpleAccent[200]=ffe040fb
purpleAccent[400]=ffd500f9
purpleAccent[700]=ffaa00ff
deepPurpleAccent.primary=ff7c4dff
deepPurpleAccent[100]=ffb388ff
deepPurpleAccent[200]=ff7c4dff
deepPurpleAccent[400]=ff651fff
deepPurpleAccent[700]=ff6200ea
indigoAccent.primary=ff536dfe
indigoAccent[100]=ff8c9eff
indigoAccent[200]=ff536dfe
indigoAccent[400]=ff3d5afe
indigoAccent[700]=ff304ffe
blueAccent.primary=ff448aff
blueAccent[100]=ff82b1ff
blueAccent[200]=ff448aff
blueAccent[400]=ff2979ff
blueAccent[700]=ff2962ff
lightBlueAccent.primary=ff40c4ff
lightBlueAccent[100]=ff80d8ff
lightBlueAccent[200]=ff40c4ff
lightBlueAccent[400]=ff00b0ff
lightBlueAccent[700]=ff0091ea
cyanAccent.primary=ff18ffff
cyanAccent[100]=ff84ffff
cyanAccent[200]=ff18ffff
cyanAccent[400]=ff00e5ff
cyanAccent[700]=ff00b8d4
tealAccent.primary=ff64ffda
tealAccent[100]=ffa7ffeb
tealAccent[200]=ff64ffda
tealAccent[400]=ff1de9b6
tealAccent[700]=ff00bfa5
greenAccent.primary=ff69f0ae
greenAccent[100]=ffb9f6ca
greenAccent[200]=ff69f0ae
greenAccent[400]=ff00e676
greenAccent[700]=ff00c853
lightGreenAccent.primary=ffb2ff59
lightGreenAccent[100]=ffccff90
lightGreenAccent[200]=ffb2ff59
lightGreenAccent[400]=ff76ff03
lightGreenAccent[700]=ff64dd17
limeAccent.primary=ffeeff41
limeAccent[100]=fff4ff81
limeAccent[200]=ffeeff41
limeAccent[400]=ffc6ff00
limeAccent[700]=ffaeea00
yellowAccent.primary=ffffff00
yellowAccent[100]=ffffff8d
yellowAccent[200]=ffffff00
yellowAccent[400]=ffffea00
yellowAccent[700]=ffffd600
amberAccent.primary=ffffd740
amberAccent[100]=ffffe57f
amberAccent[200]=ffffd740
amberAccent[400]=ffffc400
amberAccent[700]=ffffab00
orangeAccent.primary=ffffab40
orangeAccent[100]=ffffd180
orangeAccent[200]=ffffab40
orangeAccent[400]=ffff9100
orangeAccent[700]=ffff6d00
deepOrangeAccent.primary=ffff6e40
deepOrangeAccent[100]=ffff9e80
deepOrangeAccent[200]=ffff6e40
deepOrangeAccent[400]=ffff3d00
Expand Down
22 changes: 22 additions & 0 deletions src/io/flutter/editor/FlutterEditorAnnotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder hold
attachColorIcon(element, holder, color);
}
}
else if (!(element.getParent() instanceof DartArrayAccessExpression) && colors.containsKey(key + ".primary")) {
// If we're a primary color access, and we're not followed by an array access (really referencing a
// more specific color).
final Color color = getColor(key + ".primary");
if (color != null) {
attachColorIcon(element, holder, color);
}
}
}
else if (text.startsWith("Icons.")) {
final String key = text.substring("Icons.".length());
Expand Down Expand Up @@ -114,6 +122,20 @@ else if (element instanceof DartNewExpression) {
catch (NumberFormatException ignored) {
}
}
else if (text.startsWith("const Color(") && text.endsWith(")")) {
String val = text.substring("const Color(".length());
val = val.substring(0, val.length() - 1);
try {
final long value = val.startsWith("0x")
? Long.parseLong(val.substring(2), 16)
: Long.parseLong(val);
//noinspection UseJBColor
final Color color = new Color((int)(value >> 16) & 0xFF, (int)(value >> 8) & 0xFF, (int)value & 0xFF, (int)(value >> 24) & 0xFF);
attachColorIcon(element, holder, color);
}
catch (NumberFormatException ignored) {
}
}
}
}

Expand Down
1 change: 0 additions & 1 deletion src/io/flutter/sdk/FlutterSettingsConfigurable.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import io.flutter.FlutterBundle;
import io.flutter.FlutterConstants;
import io.flutter.FlutterInitializer;
import io.flutter.dart.DartPlugin;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down
Loading

0 comments on commit 89f1eb1

Please sign in to comment.