Skip to content

Conversation

@Ornanovitch
Copy link
Contributor

@Ornanovitch Ornanovitch commented Nov 24, 2022

Fixes #3693

Changes proposed in this pull request:

Quick fix for

$hexNumbers = Str::replace('#', '', $hexColor);
if (Str::length($hexNumbers) === 3) {
$hexNumbers += $hexNumbers;
}
, which seems to be unsupported (string + string operation)

Reviewers should focus on:

The before/after behavior should be tested first. See the steps to reproduce in #3693

Screenshot

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

@Ornanovitch Ornanovitch requested a review from a team as a code owner November 24, 2022 11:47
@SychO9
Copy link
Member

SychO9 commented Dec 3, 2022

I have a branch waiting for #3653 to be merged first, in which I drop te PHP code for YIQ computation, to reduce the overhead of repeating the logic for it both back and front ends.

So let's not move forward with this for now.

@Ornanovitch
Copy link
Contributor Author

Great!

$hexNumbers = Str::replace('#', '', $hexColor);
if (Str::length($hexNumbers) === 3) {
$hexNumbers += $hexNumbers;
$hexNumbers = $hexNumbers.$hexNumbers;
Copy link
Member

Choose a reason for hiding this comment

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

Could we do this as a string format instead?

@Ornanovitch
Copy link
Contributor Author

superseded by #3723

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Mentions] 3 characters hex color and isDark util: Unsupported operand types: string + string

5 participants