-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from johnfercher/release/09-01-2020
release/09-01-2020
- Loading branch information
Showing
14 changed files
with
344 additions
and
35 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package color | ||
|
||
// Color represents a color in the RGB (Red, Green, Blue) space, | ||
// is possible mix values, when all values are 0 the result color is black | ||
// when all values are 255 the result color is white | ||
type Color struct { | ||
// Red is the amount of red | ||
Red int | ||
// Green is the amount of red | ||
Green int | ||
// Blue is the amount of red | ||
Blue int | ||
} | ||
|
||
// IsWhite from Color will return true if all components of color | ||
// are in the maximum value | ||
func (s *Color) IsWhite() bool { | ||
return s.Red == 255 && s.Green == 255 && s.Blue == 255 | ||
} | ||
|
||
// NewWhite return a Color with all components (red, green and blue) as 255 | ||
func NewWhite() Color { | ||
return Color{ | ||
Red: 255, | ||
Green: 255, | ||
Blue: 255, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package color_test | ||
|
||
import ( | ||
"github.com/johnfercher/maroto/pkg/color" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestNewWhite(t *testing.T) { | ||
// Act | ||
white := color.NewWhite() | ||
|
||
// Assert | ||
assert.Equal(t, 255, white.Red) | ||
assert.Equal(t, 255, white.Green) | ||
assert.Equal(t, 255, white.Blue) | ||
} | ||
|
||
func TestColor_IsWhite(t *testing.T) { | ||
// Act | ||
white := color.NewWhite() | ||
|
||
// Assert | ||
assert.True(t, white.IsWhite()) | ||
} |
Oops, something went wrong.