2021-11-26 22:04:45 +09:00
< ? php
declare ( strict_types = 1 );
// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}
namespace Plugin\Oomox\Entity ;
use App\Core\Entity ;
use DateTimeInterface ;
/**
* For storing theme colour settings
*
* @ package GNUsocial
* @ category Oomox
*
* @ author Eliseu Amaro < mail @ eliseuama . ro >
* @ copyright 2020 Free Software Foundation , Inc http :// www . fsf . org
* @ license https :// www . gnu . org / licenses / agpl . html GNU AGPL v3 or later
*/
class Oomox extends Entity
{
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $actor_id ;
2021-11-28 03:10:26 +09:00
private ? string $colour_foreground_light ;
private ? string $colour_background_hard_light ;
private ? string $colour_background_card_light ;
private ? string $colour_border_light ;
private ? string $colour_accent_light ;
private ? string $colour_foreground_dark ;
private ? string $colour_background_hard_dark ;
private ? string $colour_background_card_dark ;
private ? string $colour_border_dark ;
private ? string $colour_accent_dark ;
2021-11-28 05:26:44 +09:00
private DateTimeInterface $created ;
private DateTimeInterface $modified ;
2021-11-26 22:04:45 +09:00
public function setActorId ( int $actor_id ) : self
{
$this -> actor_id = $actor_id ;
return $this ;
}
public function getActorId () : int
{
return $this -> actor_id ;
}
2021-11-28 03:10:26 +09:00
public function setColourForegroundLight ( ? string $colour_foreground_light ) : self
2021-11-26 22:04:45 +09:00
{
2021-11-28 03:10:26 +09:00
$this -> colour_foreground_light = $colour_foreground_light ;
2021-11-26 22:04:45 +09:00
return $this ;
}
2021-11-28 03:10:26 +09:00
public function getColourForegroundLight () : ? string
2021-11-26 22:04:45 +09:00
{
2021-11-28 03:10:26 +09:00
return $this -> colour_foreground_light ;
2021-11-26 22:04:45 +09:00
}
2021-11-28 03:10:26 +09:00
public function setColourBackgroundHardLight ( ? string $colour_background_hard_light ) : self
2021-11-26 22:04:45 +09:00
{
2021-11-28 03:10:26 +09:00
$this -> colour_background_hard_light = $colour_background_hard_light ;
2021-11-26 22:04:45 +09:00
return $this ;
}
2021-11-28 03:10:26 +09:00
public function getColourBackgroundHardLight () : ? string
2021-11-26 22:04:45 +09:00
{
2021-11-28 03:10:26 +09:00
return $this -> colour_background_hard_light ;
2021-11-26 22:04:45 +09:00
}
2021-11-28 03:10:26 +09:00
public function setColourBackgroundCardLight ( ? string $colour_background_card_light ) : self
2021-11-26 23:44:35 +09:00
{
2021-11-28 03:10:26 +09:00
$this -> colour_background_card_light = $colour_background_card_light ;
2021-11-26 23:44:35 +09:00
return $this ;
}
2021-11-28 03:10:26 +09:00
public function getColourBackgroundCardLight () : ? string
2021-11-26 23:44:35 +09:00
{
2021-11-28 03:10:26 +09:00
return $this -> colour_background_card_light ;
2021-11-26 23:44:35 +09:00
}
2021-11-28 03:10:26 +09:00
public function setColourBorderLight ( ? string $colour_border_light ) : self
2021-11-26 23:44:35 +09:00
{
2021-11-28 03:10:26 +09:00
$this -> colour_border_light = $colour_border_light ;
2021-11-26 23:44:35 +09:00
return $this ;
}
2021-11-28 03:10:26 +09:00
public function getColourBorderLight () : ? string
2021-11-26 23:44:35 +09:00
{
2021-11-28 03:10:26 +09:00
return $this -> colour_border_light ;
2021-11-26 23:44:35 +09:00
}
2021-11-28 03:10:26 +09:00
public function setColourAccentLight ( ? string $colour_accent_light ) : self
2021-11-26 23:44:35 +09:00
{
2021-11-28 03:10:26 +09:00
$this -> colour_accent_light = $colour_accent_light ;
2021-11-26 23:44:35 +09:00
return $this ;
}
2021-11-28 03:10:26 +09:00
public function getColourAccentLight () : ? string
2021-11-26 23:44:35 +09:00
{
2021-11-28 03:10:26 +09:00
return $this -> colour_accent_light ;
2021-11-26 23:44:35 +09:00
}
2021-11-28 03:10:26 +09:00
public function setColourForegroundDark ( ? string $colour_foreground_dark ) : self
{
$this -> colour_foreground_dark = $colour_foreground_dark ;
return $this ;
}
public function getColourForegroundDark () : ? string
{
return $this -> colour_foreground_dark ;
}
public function setColourBackgroundHardDark ( ? string $colour_background_hard_dark ) : self
{
$this -> colour_background_hard_dark = $colour_background_hard_dark ;
return $this ;
}
public function getColourBackgroundHardDark () : ? string
{
return $this -> colour_background_hard_dark ;
}
public function setColourBackgroundCardDark ( ? string $colour_background_card_dark ) : self
{
$this -> colour_background_card_dark = $colour_background_card_dark ;
return $this ;
}
public function getColourBackgroundCardDark () : ? string
{
return $this -> colour_background_card_dark ;
}
public function setColourBorderDark ( ? string $colour_border_dark ) : self
{
$this -> colour_border_dark = $colour_border_dark ;
return $this ;
}
public function getColourBorderDark () : ? string
{
return $this -> colour_border_dark ;
}
public function setColourAccentDark ( ? string $colour_accent_dark ) : self
{
$this -> colour_accent_dark = $colour_accent_dark ;
return $this ;
}
public function getColourAccentDark () : ? string
{
return $this -> colour_accent_dark ;
}
2021-11-28 05:26:44 +09:00
public function setCreated ( DateTimeInterface $created ) : self
2021-11-26 22:04:45 +09:00
{
$this -> created = $created ;
return $this ;
}
2021-11-28 05:26:44 +09:00
public function getCreated () : DateTimeInterface
2021-11-26 22:04:45 +09:00
{
return $this -> created ;
}
2021-11-28 05:26:44 +09:00
public function setModified ( DateTimeInterface $modified ) : self
2021-11-26 22:04:45 +09:00
{
$this -> modified = $modified ;
return $this ;
}
2021-11-28 05:26:44 +09:00
public function getModified () : DateTimeInterface
2021-11-26 22:04:45 +09:00
{
return $this -> modified ;
}
2021-12-03 05:26:27 +09:00
public function resetTheme ( bool $is_light ) {
if ( $is_light ) {
$this -> colour_background_hard_light = '#09090d' ;
$this -> colour_background_card_light = '#ebebeb' ;
$this -> colour_foreground_light = '#f0f0f0' ;
$this -> colour_border_light = '#d5d5d5' ;
$this -> colour_accent_light = '#a22430' ;
} else {
$this -> colour_background_hard_dark = '#141216' ;
$this -> colour_background_card_dark = '#131217' ;
$this -> colour_foreground_dark = '#f0f6f6' ;
$this -> colour_border_dark = '#201f25' ;
$this -> colour_accent_dark = '#5ddbcf' ;
}
}
2021-11-26 22:04:45 +09:00
// @codeCoverageIgnoreEnd
// }}} Autocode
public static function schemaDef () : array
{
return [
'name' => 'oomox' ,
'fields' => [
2021-11-28 05:26:44 +09:00
'actor_id' => [ 'type' => 'int' , 'foreign key' => true , 'target' => 'Actor.id' , 'multiplicity' => 'one to one' , 'not null' => true , 'description' => 'foreign key to actor table' ],
2021-12-03 10:18:25 +09:00
'colour_foreground_light' => [ 'type' => 'text' , 'description' => 'colour hex code' ],
'colour_background_hard_light' => [ 'type' => 'text' , 'description' => 'colour hex code' ],
'colour_background_card_light' => [ 'type' => 'text' , 'description' => 'colour hex code' ],
'colour_border_light' => [ 'type' => 'text' , 'description' => 'colour hex code' ],
'colour_accent_light' => [ 'type' => 'text' , 'description' => 'colour hex code' ],
'colour_foreground_dark' => [ 'type' => 'text' , 'description' => 'colour hex code' ],
'colour_background_hard_dark' => [ 'type' => 'text' , 'description' => 'colour hex code' ],
'colour_background_card_dark' => [ 'type' => 'text' , 'description' => 'colour hex code' ],
'colour_border_dark' => [ 'type' => 'text' , 'description' => 'colour hex code' ],
'colour_accent_dark' => [ 'type' => 'text' , 'description' => 'colour hex code' ],
2021-11-28 05:26:44 +09:00
'created' => [ 'type' => 'datetime' , 'not null' => true , 'description' => 'date this record was created' , 'default' => 'CURRENT_TIMESTAMP' ],
'modified' => [ 'type' => 'timestamp' , 'not null' => true , 'description' => 'date this record was modified' , 'default' => 'CURRENT_TIMESTAMP' ],
2021-11-26 22:04:45 +09:00
],
'primary key' => [ 'actor_id' ],
];
}
}