Create Detail Line Legend from View Filter color and line style

Hi everyone!
Searching in this forum i’ve found these code to create filled regions based on some view filter colors.
Happens that I have some filters that should appear with lines instead of filled region.
Is it possible to transform these one?



Thank you!

Update,
I tried with these code, but now it is missing what i considered the “final part”.
I managed to create the lines according to the number of filters and created the line styles with the filter properties. Now I don’t know how to join these two results so that the lines have the line style properties.