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

Cell background color is superimposed on text #455

Open
lordofscripts opened this issue Jun 14, 2024 · 0 comments
Open

Cell background color is superimposed on text #455

lordofscripts opened this issue Jun 14, 2024 · 0 comments

Comments

@lordofscripts
Copy link

Describe the bug

The text color (black) appears erased almost in their entirety by the grey/light blue stripes of the background color of each row. Furthermore, I would expect that a font size 12 would fit perfectly into a row height of 4 but it seems disproportionate.

To Reproduce

Steps to reproduce the behavior:

  1. Instantiated instance of Maroto
  2. Default font is Arial Regular 12
  3. With a loop, fill a whole document page with rows of alternating colors with a text on it
  4. See error

Related code:

func main()  {
      const ROW_HEIGHT float64 = 4
      dm := GetPoroto() // code seen in previous bug report, nothing extraordinary

      // an attempt to identify the relation between row height, font height & page height
      for i := range numberOfRows {
		dm.OneRow(strconv.Itoa(i), ROW_HEIGHT, i % 2 != 0)
      }
}

func (p *Poroto) OneRow(txt string, height float64, alt bool) {
        // to print rows in alternate colors so I can identify their height spans
	var bgCol props.Color = ColorLightSkyBlue
	if alt {
		bgCol = ColorGray
	}

        // cell property to set the background color
	var cps props.Cell = props.Cell{
		BackgroundColor: &bgCol,
	}

	var tps *props.Text = p.styler.getTextPropertiesFor(StyDefault) // source in previous bug report...
	var col core.Col = text.NewCol(12, txt, *tps)
	var row core.Row = row.New(height).WithStyle(&cps).Add(col)

	p.maroto.AddRows(row)
}

Expected behavior

The background color of the row (either gray or light blue) should stay in the background, and the black text
should be visible on top of the row/column/cell background color. The background colors and the foreground
colors are dissimilar,
so that the text should be completely visible.

Stacktrace
n.a.

Additional details (please complete the following information):

  • OS: Linux/Debian
  • GO Version 1.22
  • Maroto: v2.0.7

Additional context

As you see I have to spend considerable time trying to figure out (or rather guessing out) the relation between
row height, page height and font size...

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

No branches or pull requests

1 participant