Skip to content

Commit

Permalink
Update README to use interfaces instead of enums
Browse files Browse the repository at this point in the history
  • Loading branch information
svenluijten committed Jan 7, 2024
1 parent c3a6a35 commit 4398f72
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ composer require simonhamp/the-og --with-all-dependencies
Using The OG is really simple. Here's a basic example:

```php
use SimonHamp\TheOg\Backgrounds\JustWaves;
use SimonHamp\TheOg\Image;
use SimonHamp\TheOg\Background;

(new Image())
->accentColor('#cc0000')
->border()
->url('https://example.com/blog/some-blog-post-url')
->title('Some blog post title that is quite big and quite long')
->description('Some slightly smaller but potentially much longer subtext. It could be really long so we might need to trim it completely after many words')
->background(Background::JustWaves, 0.2)
->background(new JustWaves(), 0.2)
->save(__DIR__.'/test.png');
```

Expand All @@ -65,17 +65,20 @@ Themes are simple classes. You can create your own theme simply by extending the

```php
use SimonHamp\TheOg\Themes\AbstractTheme;
use SimonHamp\TheOg\Fonts\InterBlack;
use SimonHamp\TheOg\Fonts\InterBold;
use SimonHamp\TheOg\Fonts\InterLight;

$theme = new class(
accentColor: '#247BA0',
backgroundColor: '#ECEBE4',
baseColor: '#153B50',
baseFont: Font::InterBold,
baseFont: new InterBold(),
callToActionBackgroundColor: '#153B50',
callToActionColor: '#ECEBE4',
descriptionColor: '#429EA6',
descriptionFont: Font::InterLight,
titleFont: Font::InterBlack,
descriptionFont: new InterLight(),
titleFont: new InterBlack(),
) extends AbstractTheme {};

$image = new Image;
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Tests\Integration;

use PHPUnit\Framework\Attributes\DataProvider;
use SimonHamp\TheOg\Background;
use SimonHamp\TheOg\Backgrounds\JustWaves;
use SimonHamp\TheOg\Image;
use SimonHamp\TheOg\Themes\Themes;
use Spatie\Snapshots\MatchesSnapshots;
Expand Down Expand Up @@ -52,7 +52,7 @@ public static function snapshotImages(): iterable
Some slightly smaller but potentially much longer subtext. It could be really long so we might need to trim it completely after many words.
TEXT
)
->background(Background::JustWaves, 0.2),
->background(new JustWaves(), 0.2),
'override-some-elements',
];

Expand Down

0 comments on commit 4398f72

Please sign in to comment.