.. _colorful-sample: Colorful ######## Draw an RGB color gradient on a display device. Overview ******** This sample uses the :external+zephyr:ref:`display API ` to render an RGB color gradient across the entire display. With most display drivers, the RGB color gradient runs across the entire screen, from red through yellow to green, then from green through cyan to blue, and finally from blue through magenta back to red. This cycle repeats endlessly and changes the color of all pixels at once. It is not a static representation of an RGB color gradient; the colors simply cycle through. .. raw:: html .. tabs:: .. tab:: RGB .. raw:: html

Typical RGB output at 320x240: color gradient from red across dark yellow to green, across dark cyan to blue, across dark magenta back to red.

.. tab:: Grayscale On displays using a multi-bit luminance format (for example :c:enumerator:`PIXEL_FORMAT_L_8`), the entire screen runs over different grey level between black and white (color luminance). Other multi-bit monochrome formats behave similarly (different greys). .. raw:: html

Grayscale-style; entire screen animates through different greys (color luminance).

.. tab:: 1 bpp On displays with 1 bit per pixel, the greyscale animation of the entire screen will appear as flickering between black and white. .. raw:: html

1 bpp: entire screen animates flickering between fore- and background color (black for MONO01, white for MONO10 on a black screen).

.. tab:: E-paper By querying the display controller's capabilities, it is possible to determine if the display is an e-paper display by checking if the :c:enumerator:`SCREEN_INFO_EPD` bit is set in the :c:member:`display_capabilities.screen_info`. For such displays, the color of the entire screen will change at a much slower rate than on a typical LCD, to align with the typical refresh rate of e-ink technologies. Building and Running ******************** As this is a generic sample it should work with any display supported by Zephyr. Below is an example on how to build for a :external+zephyr:zephyr:board:`nrf52840dk` board with a :external+zephyr:ref:`adafruit_2_8_tft_touch_v2`. .. zephyr-app-commands:: :app: bridle/samples/display/colorful :build-dir: colorful :board: nrf52840dk/nrf52840 :shield: adafruit_2_8_tft_touch_v2 :goals: build :compact: For testing purpose without the need of any hardware, the :external+zephyr:zephyr:board:`native_sim/native/64 ` board is also supported and can be built as follows: .. zephyr-app-commands:: :app: bridle/samples/display/colorful :build-dir: colorful :board: native_sim/native/64 :goals: run :compact: Twister test suites =================== To run the test with twister on emulated or dummy hardware, use the following command: .. code-block:: shell west twister -v -X fixture_display -T bridle/samples/display/colorful -s sample.display.colorful.sdl -s sample.display.colorful.dummy To run all test with twister, use the following command: .. code-block:: shell west twister -v -T bridle/samples/display/colorful List of Arduino-based display shields ************************************* - :external+zephyr:ref:`adafruit_2_8_tft_touch_v2` - :external+zephyr:ref:`ssd1306_128_shield` - :external+zephyr:ref:`st7789v_generic` - :external+zephyr:ref:`waveshare_epaper`