getgrav / getgrav/grav-plugin-devtools
Theme inheritance. Problem with apostrophe and quotes.
- Dominant language
- PHP
- Stars
- 43
- Forks
- 29
- Avg merge
- 9h 28m
- Merged PRs (30d)
- 1
Description
Tried to inherit Typhoon theme and got an error:
```php
TypeError
Argument 1 passed to Mexitek\PHPColors\Color::__construct() must be of the type string, null given,
called in /Users/artyom/domains/mydomain/user/plugins/color-tools/color-tools.php on line 65
/**
* Instantiates the class with a HEX value
* @param string $hex
* @throws Exception
*/
public function __construct(string $hex). <---- this line
{
$color = self::sanitizeHex($hex);
$this->_hex = $color;
$this->_hsl = self::hexToHsl($color);
$this->_rgb = self::hexToRgb($color);
}
```
Console:
```yaml
➜ mydomain bin/plugin devtools new-theme
Enter Theme Name:
> My Typhoon
Enter Theme Description:
> Customizing Typhoon
Enter Developer Name:
> Artyom Mezin
Enter GitHub ID (can be blank):
> 7556290
Enter Developer Email:
> my@mail.site
Please choose an option:
[pure-blank ] Basic Theme using Pure.css
[tailwind ] Basic Theme using tailwind.css
[inheritance] Inherit from another theme
[copy ] Copy another theme
> inheritance
Please choose a theme to extend:
[0] quark
[1] typhoon
> 1
SUCCESS theme My Typhoon -> Created Successfully
Path: /Users/artyom/domains/mydomain/user/themes/my-typhoon
```
Ok. Cache cleared, browser refreshed, error still exist... found another issue: https://github.com/getgrav/grav/issues/3549
Decided to compare `typhoon.yaml` and `my-typhoon.yaml` to find differences and that's it:

Normal `typhoon.yaml` color block:
```yaml
colors: # Doesn't work for modular as the CSS is page-level
text_style: 'text-gray-600 dark:text-gray-400' # Text color (Any valid Tailwind color)
brightness_lighter: '20' # The percentage amount brighter for *-primary-lighter colors
brightness_darker: '20' # The percentage amount darker for *-primary-darker colors
primary: '#3893F8' # The primary accent color used throughout the page (Any valid Tailwind color)
```
Bad `my-typhoon.yaml` color block:
```yaml
colors: # Doesn't work for modular as the CSS is page-level
text_style: 'text-gray-600 dark:text-gray-400' # Text color (Any valid Tailwind color)
brightness_lighter: '20' # The percentage amount brighter for *-primary-lighter colors
brightness_darker: '20' # The percentage amount darker for *-primary-darker colors
primary: '#3893F8' # The primary accent color used throughout the page (Any valid Tailwind color)
```
Why does it use `'` istead of `'`?
Same about quotes:

`"` istead of `"`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.