(value uint8)
| 563 | } |
| 564 | |
| 565 | func (color Color) Sub(value uint8) Color { |
| 566 | |
| 567 | newColor := NewColor(color.RGBA()) |
| 568 | |
| 569 | for i, c := range newColor[:3] { |
| 570 | |
| 571 | if c < value { |
| 572 | newColor[i] = 0 |
| 573 | } else if int(c)-int(value) > 255 { |
| 574 | newColor[i] = 1 |
| 575 | } else { |
| 576 | newColor[i] -= value |
| 577 | } |
| 578 | |
| 579 | } |
| 580 | |
| 581 | return newColor |
| 582 | |
| 583 | } |
| 584 | |
| 585 | func (color Color) IsDark() bool { |
| 586 | threshold := 60 |
no test coverage detected