SwiftUI-ContributionChart icon indicating copy to clipboard operation
SwiftUI-ContributionChart copied to clipboard

color of block appears transparent instead of light gray when it is equal to zero

Open coofzilla opened this issue 2 years ago • 0 comments

I'm following the demo code and the blocks are transparent when the value is equal to 0.

I changed the following to make it appear gray:

// Original Implementation:
//                    RoundedRectangle(cornerRadius: heatMapRectangleRadius)
//                        .frame(width: heatMapRectangleWidth, height: heatMapRectangleWidth, alignment: .center)
//                        .foregroundColor(blockColor
//                            .opacity(opacityRatio(index: index)))


                    RoundedRectangle(cornerRadius: heatMapRectangleRadius)
                        .frame(width: heatMapRectangleWidth, height: heatMapRectangleWidth, alignment: .center)
                        .foregroundColor(rowData[index] == 0 ?
                            Color(red: 0.9, green: 0.9, blue: 0.9) :
                            blockColor.opacity(opacityRatio(index: index))
                        )

Before:

image

After:

image

not sure if I'm doing something wrong?

coofzilla avatar Oct 28 '23 04:10 coofzilla