Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions docs/content/en/latest/administration/appearance/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: "Appearance"
linkTitle: "Appearance"
weight: 15
no_list: true
---

Manage themes and color palettes for your organization.

## Methods

### Themes

* [list_themes](./list_themes/)
* [get_theme](./get_theme/)
* [create_theme](./create_theme/)
* [update_theme](./update_theme/)
* [delete_theme](./delete_theme/)

### Color Palettes

* [list_color_palettes](./list_color_palettes/)
* [get_color_palette](./get_color_palette/)
* [create_color_palette](./create_color_palette/)
* [update_color_palette](./update_color_palette/)
* [delete_color_palette](./delete_color_palette/)

## Example

Create a custom theme and color palette:

```python
from gooddata_sdk import GoodDataSdk, CatalogTheme, CatalogColorPalette

host = "https://www.example.com"
token = "some_user_token"
sdk = GoodDataSdk.create(host, token)

# Create a custom theme
theme = CatalogTheme.init(
theme_id="my_dark_theme",
name="My Dark Theme",
content={
"palette": {
"primary": {"base": "#14B2E2"},
},
"dashboards": {
"content": {
"widget": {
"backgroundColor": "#122330",
}
}
},
},
)
sdk.catalog_appearance.create_theme(theme)

# List all themes
themes = sdk.catalog_appearance.list_themes()

# Create a custom color palette for charts
palette = CatalogColorPalette.init(
color_palette_id="my_palette",
name="My Palette",
content={
"colorPalette": [
{"guid": "01", "fill": {"r": 140, "g": 125, "b": 232}},
{"guid": "02", "fill": {"r": 125, "g": 219, "b": 232}},
]
},
)
sdk.catalog_appearance.create_color_palette(palette)

# Clean up
sdk.catalog_appearance.delete_theme("my_dark_theme")
sdk.catalog_appearance.delete_color_palette("my_palette")
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "create_color_palette"
linkTitle: "create_color_palette"
superheading: "catalog_appearance."
weight: 220
---

``create_color_palette( color_palette: CatalogColorPalette ) -> None``

Create a new color palette.

## Parameters

| parameter | type | description |
| -- | -- | -- |
| color_palette | CatalogColorPalette | A catalog color palette object to be created. |

## Returns

_None_
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "create_theme"
linkTitle: "create_theme"
superheading: "catalog_appearance."
weight: 120
---

``create_theme( theme: CatalogTheme ) -> None``

Create a new theme.

## Parameters

| parameter | type | description |
| -- | -- | -- |
| theme | CatalogTheme | A catalog theme object to be created. |

## Returns

_None_
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "delete_color_palette"
linkTitle: "delete_color_palette"
superheading: "catalog_appearance."
weight: 240
---

``delete_color_palette( color_palette_id: str ) -> None``

Delete a color palette.

## Parameters

| parameter | type | description |
| -- | -- | -- |
| color_palette_id | str | Color palette identification string e.g. "my_palette" |

## Returns

_None_

## Raises

| type | description |
| -- | -- |
| ValueError | Color palette does not exist. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "delete_theme"
linkTitle: "delete_theme"
superheading: "catalog_appearance."
weight: 140
---

``delete_theme( theme_id: str ) -> None``

Delete a theme.

## Parameters

| parameter | type | description |
| -- | -- | -- |
| theme_id | str | Theme identification string e.g. "my_dark_theme" |

## Returns

_None_

## Raises

| type | description |
| -- | -- |
| ValueError | Theme does not exist. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "get_color_palette"
linkTitle: "get_color_palette"
superheading: "catalog_appearance."
weight: 210
---

``get_color_palette( color_palette_id: str ) -> CatalogColorPalette``

Get an individual color palette.

## Parameters

| parameter | type | description |
| -- | -- | -- |
| color_palette_id | str | Color palette identification string e.g. "my_palette" |

## Returns

| type | description |
| -- | -- |
| CatalogColorPalette | Catalog color palette object containing structure of the color palette. |
22 changes: 22 additions & 0 deletions docs/content/en/latest/administration/appearance/get_theme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "get_theme"
linkTitle: "get_theme"
superheading: "catalog_appearance."
weight: 110
---

``get_theme( theme_id: str ) -> CatalogTheme``

Get an individual theme.

## Parameters

| parameter | type | description |
| -- | -- | -- |
| theme_id | str | Theme identification string e.g. "my_dark_theme" |

## Returns

| type | description |
| -- | -- |
| CatalogTheme | Catalog theme object containing structure of the theme. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "list_color_palettes"
linkTitle: "list_color_palettes"
superheading: "catalog_appearance."
weight: 200
---

``list_color_palettes( ) -> list[CatalogColorPalette]``

Returns a list of all color palettes in the current organization.

## Parameters

_None_

## Returns

| type | description |
| -- | -- |
| list[CatalogColorPalette] | List of color palettes in the current organization. |
20 changes: 20 additions & 0 deletions docs/content/en/latest/administration/appearance/list_themes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "list_themes"
linkTitle: "list_themes"
superheading: "catalog_appearance."
weight: 100
---

``list_themes( ) -> list[CatalogTheme]``

Returns a list of all themes in the current organization.

## Parameters

_None_

## Returns

| type | description |
| -- | -- |
| list[CatalogTheme] | List of themes in the current organization. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "update_color_palette"
linkTitle: "update_color_palette"
superheading: "catalog_appearance."
weight: 230
---

``update_color_palette( color_palette: CatalogColorPalette ) -> None``

Update a color palette.

## Parameters

| parameter | type | description |
| -- | -- | -- |
| color_palette | CatalogColorPalette | A catalog color palette object to be updated. |

## Returns

_None_

## Raises

| type | description |
| -- | -- |
| ValueError | Color palette does not exist. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "update_theme"
linkTitle: "update_theme"
superheading: "catalog_appearance."
weight: 130
---

``update_theme( theme: CatalogTheme ) -> None``

Update a theme.

## Parameters

| parameter | type | description |
| -- | -- | -- |
| theme | CatalogTheme | A catalog theme object to be updated. |

## Returns

_None_

## Raises

| type | description |
| -- | -- |
| ValueError | Theme does not exist. |
1 change: 1 addition & 0 deletions packages/gooddata-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ At the moment the SDK provides services to inspect and interact with the Semanti
* Catalog User Service
* Catalog Permission Service
* Catalog Organization Service
* Catalog Appearance Service
* Visualizations Service
* Compute Service
* Table Service
Expand Down
9 changes: 9 additions & 0 deletions packages/gooddata-sdk/src/gooddata_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
import logging

from gooddata_sdk._version import __version__
from gooddata_sdk.catalog.appearance.entity_model.color_palette import (
CatalogColorPalette,
CatalogColorPaletteAttributes,
)
from gooddata_sdk.catalog.appearance.entity_model.theme import (
CatalogTheme,
CatalogThemeAttributes,
)
from gooddata_sdk.catalog.appearance.service import CatalogAppearanceService
from gooddata_sdk.catalog.data_source.action_model.requests.ldm_request import (
CatalogGenerateLdmRequest,
CatalogPdmLdmRequest,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# (C) 2024 GoodData Corporation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# (C) 2024 GoodData Corporation
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# (C) 2024 GoodData Corporation
from __future__ import annotations

from typing import Any

from attrs import define
from gooddata_api_client.model.json_api_color_palette_in import JsonApiColorPaletteIn
from gooddata_api_client.model.json_api_color_palette_in_attributes import JsonApiColorPaletteInAttributes

from gooddata_sdk.catalog.base import Base


@define(kw_only=True)
class CatalogColorPalette(Base):
id: str
attributes: CatalogColorPaletteAttributes

@staticmethod
def client_class() -> type[JsonApiColorPaletteIn]:
return JsonApiColorPaletteIn

@classmethod
def init(
cls,
color_palette_id: str,
name: str,
content: dict[str, Any],
) -> CatalogColorPalette:
return cls(id=color_palette_id, attributes=CatalogColorPaletteAttributes(content=content, name=name))


@define(kw_only=True)
class CatalogColorPaletteAttributes(Base):
content: dict[str, Any]
name: str

@staticmethod
def client_class() -> type[JsonApiColorPaletteInAttributes]:
return JsonApiColorPaletteInAttributes
Loading
Loading