Skip to content

Commit

Permalink
add config setting for luminance
Browse files Browse the repository at this point in the history
  • Loading branch information
jellygnite committed Apr 19, 2022
1 parent eab986f commit 5c7a9c5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Extensions/ImageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,25 @@

class ImageExtension extends DataExtension {

// luminance value for image to be considered light or dark
private static $luminance = 55;

private static $db = [
'Luminance' => 'Int'
];

public function IsDark() {
if($this->owner->Luminance > 0 && $this->owner->Luminance <= 55){
$luminance = $this->getOwner()->config()->get('luminance');
if($this->owner->Luminance > 0 && $this->owner->Luminance <= $luminance){
return true;
}
return false;
}
public function IsLight() {
if($this->owner->Luminance > 0 && $this->owner->Luminance > 55){
$luminance = $this->getOwner()->config()->get('luminance');
if($this->owner->Luminance > 0 && $this->owner->Luminance > $luminance){
return true;
}

return false;
}

Expand Down

0 comments on commit 5c7a9c5

Please sign in to comment.