You will need either to use the app or to create one on your own.
To find the app. just go to the Shopify app store (https://apps.shopify.com/ ), and search for product customizer. There are various options some should fit your needs
I’ve utilized the Easify Product Options app to create custom product options similar to the example you provided. Take a look at the screenshot above to see how effortlessly you can create unlimited options and variants using the app:
One of the great features of the app is the Live Preview, which allows you to set up and preview how your custom options will appear on your storefront. It provides a convenient way to ensure your options are displayed exactly as intended.
The Easify Product Options app offers both a free plan and a free trial for the paid plan, giving you the opportunity to test it out and see if it suits your needs. Rest assured, if you encounter any difficulties during the setup of your options using the app, our support team is available 24/7 via Live Chat to assist you .
You can create the main category as separate products like given below.
Main category: color
Red - A product can contain 3 heading
Green - 3 heading
Now you can use linkable variant code to link all color styles single place.
Now your red color product page will have an extra heading named color this way you will have 4 headings in every product repeat the steps to create more than 5 headings.