Skip to content

Commit ed96aca

Browse files
authored
Merge pull request #1412 from hkad98/jkd/theming
feat(gooddata-sdk): add CatalogAppearanceService for themes and color palettes
2 parents c02bf7c + 0dc9bf0 commit ed96aca

File tree

20 files changed

+588
-0
lines changed

20 files changed

+588
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: "Appearance"
3+
linkTitle: "Appearance"
4+
weight: 15
5+
no_list: true
6+
---
7+
8+
Manage themes and color palettes for your organization.
9+
10+
## Methods
11+
12+
### Themes
13+
14+
* [list_themes](./list_themes/)
15+
* [get_theme](./get_theme/)
16+
* [create_theme](./create_theme/)
17+
* [update_theme](./update_theme/)
18+
* [delete_theme](./delete_theme/)
19+
20+
### Color Palettes
21+
22+
* [list_color_palettes](./list_color_palettes/)
23+
* [get_color_palette](./get_color_palette/)
24+
* [create_color_palette](./create_color_palette/)
25+
* [update_color_palette](./update_color_palette/)
26+
* [delete_color_palette](./delete_color_palette/)
27+
28+
## Example
29+
30+
Create a custom theme and color palette:
31+
32+
```python
33+
from gooddata_sdk import GoodDataSdk, CatalogTheme, CatalogColorPalette
34+
35+
host = "https://www.example.com"
36+
token = "some_user_token"
37+
sdk = GoodDataSdk.create(host, token)
38+
39+
# Create a custom theme
40+
theme = CatalogTheme.init(
41+
theme_id="my_dark_theme",
42+
name="My Dark Theme",
43+
content={
44+
"palette": {
45+
"primary": {"base": "#14B2E2"},
46+
},
47+
"dashboards": {
48+
"content": {
49+
"widget": {
50+
"backgroundColor": "#122330",
51+
}
52+
}
53+
},
54+
},
55+
)
56+
sdk.catalog_appearance.create_theme(theme)
57+
58+
# List all themes
59+
themes = sdk.catalog_appearance.list_themes()
60+
61+
# Create a custom color palette for charts
62+
palette = CatalogColorPalette.init(
63+
color_palette_id="my_palette",
64+
name="My Palette",
65+
content={
66+
"colorPalette": [
67+
{"guid": "01", "fill": {"r": 140, "g": 125, "b": 232}},
68+
{"guid": "02", "fill": {"r": 125, "g": 219, "b": 232}},
69+
]
70+
},
71+
)
72+
sdk.catalog_appearance.create_color_palette(palette)
73+
74+
# Clean up
75+
sdk.catalog_appearance.delete_theme("my_dark_theme")
76+
sdk.catalog_appearance.delete_color_palette("my_palette")
77+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "create_color_palette"
3+
linkTitle: "create_color_palette"
4+
superheading: "catalog_appearance."
5+
weight: 220
6+
---
7+
8+
``create_color_palette( color_palette: CatalogColorPalette ) -> None``
9+
10+
Create a new color palette.
11+
12+
## Parameters
13+
14+
| parameter | type | description |
15+
| -- | -- | -- |
16+
| color_palette | CatalogColorPalette | A catalog color palette object to be created. |
17+
18+
## Returns
19+
20+
_None_
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "create_theme"
3+
linkTitle: "create_theme"
4+
superheading: "catalog_appearance."
5+
weight: 120
6+
---
7+
8+
``create_theme( theme: CatalogTheme ) -> None``
9+
10+
Create a new theme.
11+
12+
## Parameters
13+
14+
| parameter | type | description |
15+
| -- | -- | -- |
16+
| theme | CatalogTheme | A catalog theme object to be created. |
17+
18+
## Returns
19+
20+
_None_
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: "delete_color_palette"
3+
linkTitle: "delete_color_palette"
4+
superheading: "catalog_appearance."
5+
weight: 240
6+
---
7+
8+
``delete_color_palette( color_palette_id: str ) -> None``
9+
10+
Delete a color palette.
11+
12+
## Parameters
13+
14+
| parameter | type | description |
15+
| -- | -- | -- |
16+
| color_palette_id | str | Color palette identification string e.g. "my_palette" |
17+
18+
## Returns
19+
20+
_None_
21+
22+
## Raises
23+
24+
| type | description |
25+
| -- | -- |
26+
| ValueError | Color palette does not exist. |
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: "delete_theme"
3+
linkTitle: "delete_theme"
4+
superheading: "catalog_appearance."
5+
weight: 140
6+
---
7+
8+
``delete_theme( theme_id: str ) -> None``
9+
10+
Delete a theme.
11+
12+
## Parameters
13+
14+
| parameter | type | description |
15+
| -- | -- | -- |
16+
| theme_id | str | Theme identification string e.g. "my_dark_theme" |
17+
18+
## Returns
19+
20+
_None_
21+
22+
## Raises
23+
24+
| type | description |
25+
| -- | -- |
26+
| ValueError | Theme does not exist. |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: "get_color_palette"
3+
linkTitle: "get_color_palette"
4+
superheading: "catalog_appearance."
5+
weight: 210
6+
---
7+
8+
``get_color_palette( color_palette_id: str ) -> CatalogColorPalette``
9+
10+
Get an individual color palette.
11+
12+
## Parameters
13+
14+
| parameter | type | description |
15+
| -- | -- | -- |
16+
| color_palette_id | str | Color palette identification string e.g. "my_palette" |
17+
18+
## Returns
19+
20+
| type | description |
21+
| -- | -- |
22+
| CatalogColorPalette | Catalog color palette object containing structure of the color palette. |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: "get_theme"
3+
linkTitle: "get_theme"
4+
superheading: "catalog_appearance."
5+
weight: 110
6+
---
7+
8+
``get_theme( theme_id: str ) -> CatalogTheme``
9+
10+
Get an individual theme.
11+
12+
## Parameters
13+
14+
| parameter | type | description |
15+
| -- | -- | -- |
16+
| theme_id | str | Theme identification string e.g. "my_dark_theme" |
17+
18+
## Returns
19+
20+
| type | description |
21+
| -- | -- |
22+
| CatalogTheme | Catalog theme object containing structure of the theme. |
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "list_color_palettes"
3+
linkTitle: "list_color_palettes"
4+
superheading: "catalog_appearance."
5+
weight: 200
6+
---
7+
8+
``list_color_palettes( ) -> list[CatalogColorPalette]``
9+
10+
Returns a list of all color palettes in the current organization.
11+
12+
## Parameters
13+
14+
_None_
15+
16+
## Returns
17+
18+
| type | description |
19+
| -- | -- |
20+
| list[CatalogColorPalette] | List of color palettes in the current organization. |
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "list_themes"
3+
linkTitle: "list_themes"
4+
superheading: "catalog_appearance."
5+
weight: 100
6+
---
7+
8+
``list_themes( ) -> list[CatalogTheme]``
9+
10+
Returns a list of all themes in the current organization.
11+
12+
## Parameters
13+
14+
_None_
15+
16+
## Returns
17+
18+
| type | description |
19+
| -- | -- |
20+
| list[CatalogTheme] | List of themes in the current organization. |
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: "update_color_palette"
3+
linkTitle: "update_color_palette"
4+
superheading: "catalog_appearance."
5+
weight: 230
6+
---
7+
8+
``update_color_palette( color_palette: CatalogColorPalette ) -> None``
9+
10+
Update a color palette.
11+
12+
## Parameters
13+
14+
| parameter | type | description |
15+
| -- | -- | -- |
16+
| color_palette | CatalogColorPalette | A catalog color palette object to be updated. |
17+
18+
## Returns
19+
20+
_None_
21+
22+
## Raises
23+
24+
| type | description |
25+
| -- | -- |
26+
| ValueError | Color palette does not exist. |

0 commit comments

Comments
 (0)