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

Conversation

@yjbanov
Copy link
Contributor

@yjbanov yjbanov commented Mar 20, 2020

Make shadows softer by pre-multiplying the alpha by 0.4 (the number is picked purely empirically by comparing the output with Flutter for desktop).

Fixes flutter/flutter#52734

This PR requires flutter/goldens#84

@yjbanov yjbanov requested a review from ferhatb March 20, 2020 20:13
@auto-assign auto-assign bot requested a review from GaryQian March 20, 2020 20:13

import 'scuba.dart';

const Color _kShadowColor = Color.fromARGB(255, 255, 0, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the change in test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the shadows softer made the red color too subtle in the golden test, so I decided to switch the test to pitch black. Also, black shadows are the most commonly used ones.

@yjbanov yjbanov force-pushed the aggressive-shadows branch from a4aa361 to 8718856 Compare March 20, 2020 22:58
final int alpha = (0.4 * color.alpha).round();
context.fillStyle = colorComponentsToCssString(red, green, blue, alpha);
context.shadowBlur = shadow.blurWidth;
context.shadowColor = colorToCssString(color.withAlpha(0xff));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this overriding the alpha channel of the shadow color to 0xff?

Can we do this instead?

context.shadowColor = colorToCssString(color);

(Assuming that color has the right alpha value set?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[web] Shadows are too hard

4 participants