Branding
Branding in this context refers to the logo that is displayed on the ESP-DASH dashboard. You can customize the logo by defining the logo image as a byte array in the logo.h
and logo.cpp
files of the library’s source code without even touching HTML or CSS.
Procedure
To add your custom logo on the ESP-DASH Pro dashboard, follow these steps:
Prepare logo
First, you need to create or obtain the logo image you want to display on the dashboard. Ensure that the logo image is in a suitable format, such as a SVG (recommended) / PNG or JPG file and make sure your image is optimized & small in file size.
Convert logo to a byte array
To include the logo in your library, you’ll need to convert the image into a byte array.
- Go to File2Raw utility ( I created this utility a few years back for the purpose of converting files into byte array for C++ applications ).
- Select your logo.
- Select “Gzip Compress” & “Use PROGMEM (Arduino)”.
- Click “Convert”.
Modify logo.h
-
Open the
logo.h
file in your ESP-DASH library source code. -
Locate the
DASH_LOGO
byte array declaration, which should look like this:extern const uint8_t DASH_LOGO[];
-
Replace the length of the
DASH_LOGO
array with your custom logo’s byte array length. -
Locate the
DASH_LOGO_MIME
variable, which defines the MIME type of your logo image. By default, it is set toimage/png
. If your logo is in a different format (e.g., JPEG), update theDASH_LOGO_MIME
variable to the appropriate MIME type. -
Set
DASH_LOGO_WIDTH
&DASH_LOGO_HEIGHT
according to your desired size which will be displayed on the webpage.
Modify logo.cpp
-
Open the
logo.cpp
file in your ESP-DASH Pro library source code. -
Replace the contents of the
DASH_LOGO
array with your custom logo’s byte array generated in File2Raw utility.
Upload firmware
After making these changes, compile and upload the firmware with modified ESP-DASH Pro library to your device.
Final Words
Once you have uploaded the modified ESP-DASH Pro library to your device, the custom logo will be displayed on your dashboard.
That’s it! You have successfully added custom branding to the ESP-DASH Pro dashboard by defining the logo as a byte array in the logo.h
and logo.cpp
files.
Please note that branding, including logos and images, may be subject to copyright and trademark laws. Ensure you have the necessary rights or permissions to use any branding elements in your project.