Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the way to make background transparent #631

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

Watson1978
Copy link
Collaborator

@Watson1978 Watson1978 commented Mar 13, 2024

Fix #630

This patch provides two ways to make the background transparent.

1. #transparent_background=

g = Gruff::Bar.new
g.transparent_background = true # use transparent
g.title = 'Hello world'
g.data :Art, [0, 5, 8, 15]
g.data :Philosophy, [10, 3, 2, 8]
g.data :Science, [2, 15, 8, 11]

g.write('bar.png')

2. Make background to transparent by theme

g = Gruff::Bar.new
g.theme = {
  colors: [
    '#FDD84E',
    '#6886B4',
    '#72AE6E',
    '#D1695E',
    '#8A6EAF',
    '#EFAA43',
    'white'
  ],
  marker_color: 'white',
  font_color: 'white',
  background_colors: nil # use transparent
}
g.title = 'Hello world'
g.data :Art, [0, 5, 8, 15]
g.data :Philosophy, [10, 3, 2, 8]
g.data :Science, [2, 15, 8, 11]

g.write('bar.png')

@Watson1978 Watson1978 force-pushed the transparent-background branch 4 times, most recently from 0a0e60c to 1b8ec66 Compare March 13, 2024 21:02
@Watson1978 Watson1978 merged commit 401eb8e into topfunky:master Mar 13, 2024
9 checks passed
@Watson1978 Watson1978 deleted the transparent-background branch March 13, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bar chart transparent background
1 participant