diff --git a/_images/components/var_dumper/10-light-theme.png b/_images/components/var_dumper/10-light-theme.png new file mode 100644 index 00000000000..3723925c2cb Binary files /dev/null and b/_images/components/var_dumper/10-light-theme.png differ diff --git a/components/var_dumper.rst b/components/var_dumper.rst index 3b3a67b865b..2f1fe1dd863 100644 --- a/components/var_dumper.rst +++ b/components/var_dumper.rst @@ -412,6 +412,49 @@ then its dump representation:: .. image:: /_images/components/var_dumper/09-cut.png +Changing the output color of HtmlDumper +---------------------------------------- + +The :class:`Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper` class added a new :method:`Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper::setTheme` method. Now you can use both ``'dark'`` and ``'light'`` options. + +Example:: + + require __DIR__.'/vendor/autoload.php'; + + use Symfony\Component\VarDumper\VarDumper; + use Symfony\Component\VarDumper\Dumper\HtmlDumper; + use Symfony\Component\VarDumper\Cloner\VarCloner; + + $varDumper = new VarDumper(); + $varDumper::setHandler(); + + $cloner = new VarCloner(); + + $htmlDumper = new HtmlDumper(); + $htmlDumper->setTheme('light'); + + VarDumper::setHandler(function ($var) use ($cloner, $htmlDumper) { + $htmlDumper->dump($cloner->cloneVar($var)); + }); + + $data = [ + 'Now', + 'this', + 'should be', + 'lighter!', + ]; + + dump($data); + +.. image:: /_images/components/var_dumper/10-light-theme.png + +.. versionadded:: 4.2 + The :method:`Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper::setTheme` method was introduced in Symfony 4.2. + +.. note:: + The :method:`Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper::setTheme` method only works with the :class:`Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper` class. + + Learn More ---------- pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy