Skip to content

Support color transparency in addShape #2176

@xuxxxxxx0249

Description

@xuxxxxxx0249

Description

Hey community

I am wondering does excelize 2.8.1 support set up color transparency for the addShape function?

Context:
I want to set up color transparency for the addShape which will help better display for shape line.
I attached the screenshot for the expected behavior, not sure we can setup solid color fill for one of ellipse I add it.
Ideally, if add color transparency then we can better visualize the overlap line.
image

Image

Here is snap of code to generate two ellipses.
Below code will generate two ellipses with two solid color, but no color transparency.

Steps to reproduce the issue

if err := f.AddShape(sheetName, &excelize.Shape{
	Type:   "ellipse",
	Cell:   "C3",
	Width:  uint(diaComp),
	Height: uint(diaComp),
	Line: excelize.ShapeLine{
		Color: "000000",
	},
	Fill: excelize.Fill{
		Type: "pattern", Pattern: 1,
		Color: []string{"#005996"},
	},
}); err != nil {
	return fmt.Errorf("some thing wrong in the first ellipse %w", err)
}

if err := f.AddShape(sheetName, &excelize.Shape{
	Type:   "ellipse",
	Cell:   "F3",
	Width:  uint(diaFox),
	Height: uint(diaFox),
	Line: excelize.ShapeLine{
		Color: "000000",
	},
	Fill: excelize.Fill{
		Type: "pattern", Pattern: 1,
		Color: []string{"#66DBD1"},
	},
}); err != nil {
	return fmt.Errorf("some thing wrong in the second ellipse %w", err)
}

Describe the results you received

The color transparency still same

Describe the results you expected

I expected to see the color transparency has percentage setup

Go version

1.23.8

Excelize version or commit ID

2.8.1

Environment

Microsoft Excel Version 16.100

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Features

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions