jasudev / AxisContribution

A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.
MIT License
111 stars 24 forks source link

How to use Color extension #4

Closed yuntan closed 1 year ago

yuntan commented 1 year ago

Following code does not work due to Color(hex: 0xF0F0F0) is not accessible from outside of package.

AxisContribution(constant: .init(), source: [Date(), Date()]) { indexSet, data in
    Image(systemName: "heart.fill")
      .foregroundColor(Color(hex: colorScheme == .dark ? 0x171B21 : 0xF0F0F0)) // compile error
      .font(.system(size: rowSize))
      .frame(width: rowSize, height: rowSize)
} foreground: { indexSet, data in
    Image(systemName: "heart.fill")
      .foregroundColor(Color(hex: 0x6CD164)) // compile error
      .font(.system(size: rowSize))
      .frame(width: rowSize, height: rowSize)
}
jasudev commented 1 year ago

Hi, I think you can use the Color extension provided by the example app, thank you.