Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add printColor directive #60

Merged
merged 3 commits into from
Jan 29, 2024
Merged

Add printColor directive #60

merged 3 commits into from
Jan 29, 2024

Conversation

ArielMejiaDev
Copy link
Contributor

@ArielMejiaDev ArielMejiaDev commented Jan 27, 2024

How this PR adds value

I tried to answer as much questions as possible in this repo, and I learn a lot in the process, I think this PR would reduce issues related to background colors consistency.

it would be useful to avoid many developers adding issues like this in the future #10 (comment)

PR Content

it adds a directive for css printColorAdjust property:

It would be useful as some designs with tailwind CSS require this property to get an exact replicate of how colors look in a view.

it adds a param so anyone can also set this css rule as exact or as economy to print pdf with more or less colors

I can imagine someone creating a feature with a report that could be printed based on a query strings like this:

$printColors = $request->printMode === 'economy' ? 'economy' : 'exact';

return pdf()->view('reports.sales', compact('colorMode'))->download();

In blade view:

@printColor($colorMode)

<h1 class="mb-4 text-3xl font-extrabold leading-none tracking-tight text-gray-900 md:text-4xl dark:text-white">
    Sales Report
</h>

<table>
//.....
</table>

@freekmurze
Copy link
Member

Thanks for your work on this.

I like the added docs on backgrounds, but feel that the Blade directives are a bit overkill. Could you remove them from this PR?

@ArielMejiaDev
Copy link
Contributor Author

ArielMejiaDev commented Jan 29, 2024

Thanks for your work on this.

I like the added docs on backgrounds, but feel that the Blade directives are a bit overkill. Could you remove them from this PR?

Thanks, I think this addition in docs is useful, now the PR only adds a docs example & happy to help!

@freekmurze freekmurze merged commit 91fb895 into spatie:main Jan 29, 2024
1 check passed
@freekmurze
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants