You will need to enter this formula using CTRL + SHIFT + ENTER :
=SUM(IF(FREQUENCY(IF(B2:E7>0,ROW(B2:B7)),IF(B2:E7>0,ROW(B2:B7)))>0,1))
To understand how this formula works, it is important to first understand how the FREQUENCY function works.
Example 1
See the table below to see some common features of FREQUENCY and COUNTIF, passing a range of values ββto both parameters of the function:

The array returned by the COUNTIF function should not be surprising. For each 1 that appears in the table, the number 11 appears in its position in the array (the total number of units is 1). Note also that 0s appear in the array instead of all spaces.
The array returned by the FREQUENCY function is a bit more complicated. The number 11 (again, the total number 1s) appears ONLY at the position of the array, where the first number is 1. FREQUENCY avoids all empty values, and 0 found here in the array actually represents all the other instances of number one. See the table below for a clearer picture of what is going on inside FREQUENCY:

Where does the last 0 (pink) come from? The FREQUENCY function automatically adds an extra zero at the end of the array.
Example 2
Let's look at another example. Suppose our original table had not only 1s, but also 2s. See the table below:

You can see how the array returned by FREQUENCY differs from the array returned by the COUNTIF function. Refer to the table below again to find out what is going on inside FREQUENCY:

Often, the FREQUENCY function is used to find the number of unique values ββwithin a dataset. To do this here, you can simply wrap the array with this SUM and IF function:
=SUM(IF({8;0;0;3;0;0;0;0;0;0;0;0}>0,1))
This formula returns 2 (2 unique values).
Original problem

Now we can use what we learned to attack the original problem. To calculate the number of colors that make up clothing, we will need to assign each line a unique number, where the number is greater than zero. We can do this with the row function.
=IF(B2:E7,ROW(B2:B7))
See below to see how this formula "affects our table":

Then we are going to put this formula in both parameters of the FREQUENCY function:
=FREQUENCY(IF(B2:E7>0,ROW(B2:B7)),IF(B2:E7>0,ROW(B2:B7)))
See table below:

Finally, we can wrap the array using the SUM and IF functions to get the answer from 5:
=SUM(IF({3;0;0;2;0;3;0;0;1;2;0;0}>0,1))