diff options
Diffstat (limited to 'srcs')
| -rw-r--r-- | srcs/juloo.keyboard2/Theme.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/srcs/juloo.keyboard2/Theme.java b/srcs/juloo.keyboard2/Theme.java index 8539edb..0319c99 100644 --- a/srcs/juloo.keyboard2/Theme.java +++ b/srcs/juloo.keyboard2/Theme.java @@ -48,8 +48,8 @@ public class Theme activatedColor = s.getColor(R.styleable.keyboard_colorLabelActivated, 0); lockedColor = s.getColor(R.styleable.keyboard_colorLabelLocked, 0); subLabelColor = s.getColor(R.styleable.keyboard_colorSubLabel, 0); - float secondaryLightOffset = s.getFloat(R.styleable.keyboard_secondaryLightOffset, 1.f); - secondaryLabelColor = adjustLight(labelColor, secondaryLightOffset); + secondaryLabelColor = adjustLight(labelColor, + s.getFloat(R.styleable.keyboard_secondaryDimming, 0.25f)); keyBorderRadius = s.getDimension(R.styleable.keyboard_keyBorderRadius, 0); keyBorderWidth = s.getDimension(R.styleable.keyboard_keyBorderWidth, 0); keyBorderWidthActivated = s.getDimension(R.styleable.keyboard_keyBorderWidthActivated, 0); @@ -85,11 +85,13 @@ public class Theme return _indicationPaint; } - int adjustLight(int color, float offset) + /** Interpolate the 'value' component toward its opposite by 'alpha'. */ + int adjustLight(int color, float alpha) { float[] hsv = new float[3]; Color.colorToHSV(color, hsv); - hsv[2] += offset; + float v = hsv[2]; + hsv[2] = alpha - (2 * alpha - 1) * v; return Color.HSVToColor(hsv); } |
