I previously inquired about a solution on Another Question. However, I wanted to get further clarification here and explore if there is a more streamlined approach to achieve the desired effect depicted in the image below.
In case where multiple components are present on a page (some of them possibly containing child components), I am aiming to add a border around each one (potentially with randomly changing colors) and display the component name (or selector name) at the upper right corner of each component's box. My goal is to easily identify the layout of components on the page.
There are 2 key questions I have:
1. What would be the simplest method to accomplish this when there are both custom and third-party components on the page?
2. How can this be achieved most easily for custom components only?
Please note: I prefer a non-intrusive way to implement this feature and it should be possible to show/hide the borders and component names using a global variable that can be toggled for debugging purposes.
This is the desired outcome I aim to achieve: https://i.sstatic.net/gUlIe.jpg
Update: I have added 2 screenshots
Application components: https://i.sstatic.net/02uTA.jpg
Batarangle 2 view of the application: https://i.sstatic.net/fdMVQ.jpg