You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2025/07/16 01:26:28 UTC

(superset) 01/02: feat: add a theme CRUD page to manage themes

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch theme_crud
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 694de31e91610a1cc5f6491590a76440832bc1d3
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Tue Jul 15 18:09:33 2025 -0700

    feat: add a theme CRUD page to manage themes
---
 .../packages/superset-ui-core/src/theme/types.ts   |   5 +
 .../src/features/themes/ThemeModal.tsx             | 403 +++++++++++++++++++++
 superset-frontend/src/features/themes/types.ts     |  30 ++
 superset-frontend/src/pages/ThemeList/index.tsx    | 317 ++++++++++++++++
 superset-frontend/src/theme/ThemeController.ts     | 145 ++++++++
 superset-frontend/src/theme/ThemeProvider.tsx      |  43 ++-
 superset-frontend/src/views/routes.tsx             |   8 +
 superset/commands/theme/__init__.py                |   0
 superset/commands/theme/delete.py                  |  48 +++
 superset/commands/theme/exceptions.py              |  27 ++
 superset/config.py                                 |   2 +-
 superset/daos/theme.py                             |  28 ++
 superset/initialization/__init__.py                |  12 +
 .../2025-07-15_16-40_3fd555e76e3d_theme_crud.py    |  65 ++++
 superset/models/core.py                            |  11 +
 superset/themes/api.py                             | 316 ++++++++++++++++
 superset/themes/filters.py                         |  40 ++
 superset/themes/schemas.py                         |  35 ++
 superset/views/themes.py                           |  40 ++
 tests/integration_tests/themes/__init__.py         |   0
 tests/integration_tests/themes/api_tests.py        | 384 ++++++++++++++++++++
 tests/unit_tests/themes/__init__.py                |   0
 tests/unit_tests/themes/api_test.py                |  94 +++++
 tests/unit_tests/themes/model_test.py              |  53 +++
 24 files changed, 2104 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-core/src/theme/types.ts b/superset-frontend/packages/superset-ui-core/src/theme/types.ts
index f8c0f875d5..e599c14a80 100644
--- a/superset-frontend/packages/superset-ui-core/src/theme/types.ts
+++ b/superset-frontend/packages/superset-ui-core/src/theme/types.ts
@@ -419,4 +419,9 @@ export interface ThemeContextType {
   setTheme: (config: AnyThemeConfig) => void;
   setThemeMode: (newMode: ThemeMode) => void;
   resetTheme: () => void;
+  setCrudTheme: (themeId: string | null) => Promise<void>;
+  setTemporaryTheme: (config: AnyThemeConfig) => void;
+  clearLocalOverrides: () => void;
+  getCurrentCrudThemeId: () => string | null;
+  hasDevOverride: () => boolean;
 }
diff --git a/superset-frontend/src/features/themes/ThemeModal.tsx b/superset-frontend/src/features/themes/ThemeModal.tsx
new file mode 100644
index 0000000000..5e03c54cdc
--- /dev/null
+++ b/superset-frontend/src/features/themes/ThemeModal.tsx
@@ -0,0 +1,403 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { FunctionComponent, useState, useEffect, ChangeEvent } from 'react';
+
+import { css, styled, t, useTheme } from '@superset-ui/core';
+import { useSingleViewResource } from 'src/views/CRUD/hooks';
+import { useThemeContext } from 'src/theme/ThemeProvider';
+import { isUserAdmin } from 'src/dashboard/util/permissionUtils';
+import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes';
+import getBootstrapData from 'src/utils/getBootstrapData';
+
+import { Icons } from '@superset-ui/core/components/Icons';
+import withToasts from 'src/components/MessageToasts/withToasts';
+import { Input, Modal, JsonEditor, Button } from '@superset-ui/core/components';
+import { Typography } from '@superset-ui/core/components/Typography';
+
+import { OnlyKeyWithType } from 'src/utils/types';
+import { ThemeObject } from './types';
+
+interface ThemeModalProps {
+  addDangerToast: (msg: string) => void;
+  addSuccessToast?: (msg: string) => void;
+  theme?: ThemeObject | null;
+  onThemeAdd?: (theme?: ThemeObject) => void;
+  onHide: () => void;
+  show: boolean;
+}
+
+type ThemeStringKeys = keyof Pick<
+  ThemeObject,
+  OnlyKeyWithType<ThemeObject, String>
+>;
+
+const StyledThemeTitle = styled.div(
+  ({ theme }) => css`
+    margin: ${theme.sizeUnit * 2}px auto ${theme.sizeUnit * 4}px auto;
+  `,
+);
+
+const StyledJsonEditor = styled.div`
+  ${({ theme }) => css`
+    border-radius: ${theme.borderRadius}px;
+    border: 1px solid ${theme.colorBorder};
+
+    .ace_editor {
+      border-radius: ${theme.borderRadius}px;
+    }
+  `}
+`;
+
+const ThemeContainer = styled.div(
+  ({ theme }) => css`
+    margin-bottom: ${theme.sizeUnit * 10}px;
+
+    .control-label {
+      margin-bottom: ${theme.sizeUnit * 2}px;
+    }
+
+    .required {
+      margin-left: ${theme.sizeUnit / 2}px;
+      color: ${theme.colorErrorText};
+    }
+
+    input[type='text'] {
+      padding: ${theme.sizeUnit * 1.5}px ${theme.sizeUnit * 2}px;
+      border: 1px solid ${theme.colorBorder};
+      border-radius: ${theme.borderRadius}px;
+      width: 50%;
+    }
+  `,
+);
+
+const ThemeModal: FunctionComponent<ThemeModalProps> = ({
+  addDangerToast,
+  addSuccessToast,
+  onThemeAdd,
+  onHide,
+  show,
+  theme = null,
+}) => {
+  const supersetTheme = useTheme();
+  const { setTemporaryTheme, clearLocalOverrides, hasDevOverride } =
+    useThemeContext();
+  const [disableSave, setDisableSave] = useState<boolean>(true);
+  const [currentTheme, setCurrentTheme] = useState<ThemeObject | null>(null);
+  const [isHidden, setIsHidden] = useState<boolean>(true);
+  const isEditMode = theme !== null;
+  const user = getBootstrapData()?.user;
+  const canDevelopThemes = user
+    ? isUserAdmin(user as UserWithPermissionsAndRoles)
+    : false;
+
+  // theme fetch logic
+  const {
+    state: { loading, resource },
+    fetchResource,
+    createResource,
+    updateResource,
+  } = useSingleViewResource<ThemeObject>('theme', t('theme'), addDangerToast);
+
+  // Functions
+  const hide = () => {
+    onHide();
+    setCurrentTheme(null);
+  };
+
+  const onSave = () => {
+    if (isEditMode) {
+      // Edit
+      if (currentTheme?.uuid || currentTheme?.id) {
+        const update_id = currentTheme.uuid || currentTheme.id;
+        delete currentTheme.id;
+        delete currentTheme.uuid;
+        delete currentTheme.created_by;
+        delete currentTheme.changed_by;
+        delete currentTheme.changed_on_delta_humanized;
+
+        updateResource(update_id as number, currentTheme).then(response => {
+          if (!response) {
+            return;
+          }
+
+          if (onThemeAdd) {
+            onThemeAdd();
+          }
+
+          hide();
+        });
+      }
+    } else if (currentTheme) {
+      // Create
+      createResource(currentTheme).then(response => {
+        if (!response) {
+          return;
+        }
+
+        if (onThemeAdd) {
+          onThemeAdd();
+        }
+
+        hide();
+      });
+    }
+  };
+
+  const onApply = () => {
+    if (currentTheme?.json_data && isValidJson(currentTheme.json_data)) {
+      try {
+        const themeConfig = JSON.parse(currentTheme.json_data);
+        setTemporaryTheme(themeConfig);
+        if (addSuccessToast) {
+          addSuccessToast(t('Theme applied temporarily for preview'));
+        }
+      } catch (error) {
+        addDangerToast(t('Failed to apply theme: Invalid JSON'));
+      }
+    }
+  };
+
+  const onClearLocalSettings = () => {
+    clearLocalOverrides();
+    if (addSuccessToast) {
+      addSuccessToast(t('Local theme settings cleared'));
+    }
+  };
+
+  const onThemeNameChange = (event: ChangeEvent<HTMLInputElement>) => {
+    const { target } = event;
+
+    const data = {
+      ...currentTheme,
+      theme_name: currentTheme ? currentTheme.theme_name : '',
+      json_data: currentTheme ? currentTheme.json_data : '',
+    };
+
+    data[target.name as ThemeStringKeys] = target.value;
+    setCurrentTheme(data);
+  };
+
+  const onJsonDataChange = (jsonData: string) => {
+    const data = {
+      ...currentTheme,
+      theme_name: currentTheme ? currentTheme.theme_name : '',
+      json_data: jsonData,
+    };
+    setCurrentTheme(data);
+  };
+
+  const isValidJson = (str?: string) => {
+    if (!str) return false;
+    try {
+      JSON.parse(str);
+      return true;
+    } catch (e) {
+      return false;
+    }
+  };
+
+  const validate = () => {
+    if (
+      currentTheme?.theme_name.length &&
+      currentTheme?.json_data?.length &&
+      isValidJson(currentTheme.json_data)
+    ) {
+      setDisableSave(false);
+    } else {
+      setDisableSave(true);
+    }
+  };
+
+  // Initialize
+  useEffect(() => {
+    if (
+      isEditMode &&
+      ((!currentTheme?.uuid && !currentTheme?.id) ||
+        (theme &&
+          theme?.uuid !== currentTheme.uuid &&
+          theme?.id !== currentTheme.id) ||
+        (isHidden && show))
+    ) {
+      if ((theme?.uuid || theme?.id) && !loading) {
+        const id = theme.uuid || theme.id || 0;
+
+        fetchResource(typeof id === 'string' ? parseInt(id, 10) : id);
+      }
+    } else if (
+      !isEditMode &&
+      (!currentTheme ||
+        currentTheme.id ||
+        currentTheme.uuid ||
+        (isHidden && show))
+    ) {
+      const defaultThemeConfig = {
+        colors: {
+          primary: {
+            base: supersetTheme.colorPrimary,
+          },
+          secondary: {
+            base: supersetTheme.colorFillSecondary,
+          },
+          grayscale: {
+            base: supersetTheme.colorText,
+          },
+        },
+        typography: {
+          families: {
+            sansSerif: 'Inter',
+            serif: 'Georgia',
+            monospace: 'Consolas',
+          },
+          weights: {
+            light: 200,
+            normal: 400,
+            bold: 700,
+          },
+        },
+      };
+
+      setCurrentTheme({
+        theme_name: '',
+        json_data: JSON.stringify(defaultThemeConfig, null, 2),
+      });
+    }
+  }, [theme, show]);
+
+  useEffect(() => {
+    if (resource) {
+      setCurrentTheme(resource);
+    }
+  }, [resource]);
+
+  // Validation
+  useEffect(() => {
+    validate();
+  }, [
+    currentTheme ? currentTheme.theme_name : '',
+    currentTheme ? currentTheme.json_data : '',
+  ]);
+
+  // Show/hide
+  if (isHidden && show) {
+    setIsHidden(false);
+  }
+
+  return (
+    <Modal
+      disablePrimaryButton={disableSave}
+      onHandledPrimaryAction={onSave}
+      onHide={hide}
+      primaryButtonName={isEditMode ? t('Save') : t('Add')}
+      show={show}
+      width="55%"
+      footer={[
+        <Button key="cancel" onClick={hide}>
+          {t('Cancel')}
+        </Button>,
+        ...(canDevelopThemes
+          ? [
+              <Button
+                key="clear-local"
+                onClick={onClearLocalSettings}
+                disabled={!hasDevOverride()}
+                type="default"
+              >
+                {t('Clear Local Settings')}
+              </Button>,
+              <Button
+                key="apply"
+                onClick={onApply}
+                disabled={
+                  !currentTheme?.json_data ||
+                  !isValidJson(currentTheme.json_data)
+                }
+                type="default"
+              >
+                {t('Apply')}
+              </Button>,
+            ]
+          : []),
+        <Button
+          key="save"
+          onClick={onSave}
+          disabled={disableSave}
+          type="primary"
+        >
+          {isEditMode ? t('Save') : t('Add')}
+        </Button>,
+      ]}
+      title={
+        <Typography.Title level={4} data-test="theme-modal-title">
+          {isEditMode ? (
+            <Icons.EditOutlined
+              iconSize="l"
+              css={css`
+                margin: auto ${supersetTheme.sizeUnit * 2}px auto 0;
+              `}
+            />
+          ) : (
+            <Icons.PlusOutlined
+              iconSize="l"
+              css={css`
+                margin: auto ${supersetTheme.sizeUnit * 2}px auto 0;
+              `}
+            />
+          )}
+          {isEditMode ? t('Edit theme properties') : t('Add theme')}
+        </Typography.Title>
+      }
+    >
+      <StyledThemeTitle>
+        <Typography.Title level={4}>{t('Basic information')}</Typography.Title>
+      </StyledThemeTitle>
+      <ThemeContainer>
+        <div className="control-label">
+          {t('Name')}
+          <span className="required">*</span>
+        </div>
+        <Input
+          name="theme_name"
+          onChange={onThemeNameChange}
+          type="text"
+          value={currentTheme?.theme_name}
+        />
+      </ThemeContainer>
+      <ThemeContainer>
+        <div className="control-label">
+          {t('JSON Configuration')}
+          <span className="required">*</span>
+        </div>
+        <StyledJsonEditor>
+          <JsonEditor
+            showLoadingForImport
+            name="json_data"
+            value={currentTheme?.json_data || ''}
+            onChange={onJsonDataChange}
+            tabSize={2}
+            width="100%"
+            height="300px"
+            wrapEnabled
+          />
+        </StyledJsonEditor>
+      </ThemeContainer>
+    </Modal>
+  );
+};
+
+export default withToasts(ThemeModal);
diff --git a/superset-frontend/src/features/themes/types.ts b/superset-frontend/src/features/themes/types.ts
new file mode 100644
index 0000000000..6f7eaac99e
--- /dev/null
+++ b/superset-frontend/src/features/themes/types.ts
@@ -0,0 +1,30 @@
+import Owner from 'src/types/Owner';
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+export type ThemeObject = {
+  id?: number;
+  uuid?: string;
+  changed_on_delta_humanized?: string;
+  created_on?: string;
+  changed_by?: Owner;
+  created_by?: Owner;
+  json_data?: string;
+  theme_name: string;
+};
diff --git a/superset-frontend/src/pages/ThemeList/index.tsx b/superset-frontend/src/pages/ThemeList/index.tsx
new file mode 100644
index 0000000000..633aaa2283
--- /dev/null
+++ b/superset-frontend/src/pages/ThemeList/index.tsx
@@ -0,0 +1,317 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { useMemo, useState } from 'react';
+import { t, SupersetClient } from '@superset-ui/core';
+
+import rison from 'rison';
+import { useListViewResource } from 'src/views/CRUD/hooks';
+import { createErrorHandler, createFetchRelated } from 'src/views/CRUD/utils';
+import withToasts from 'src/components/MessageToasts/withToasts';
+import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu';
+import { DeleteModal, ConfirmStatusChange } from '@superset-ui/core/components';
+import {
+  ModifiedInfo,
+  ListView,
+  ListViewActionsBar,
+  ListViewFilterOperator as FilterOperator,
+  type ListViewProps,
+  type ListViewActionProps,
+  type ListViewFilters,
+} from 'src/components';
+
+import ThemeModal from 'src/features/themes/ThemeModal';
+import { ThemeObject } from 'src/features/themes/types';
+import { QueryObjectColumns } from 'src/views/CRUD/types';
+import { Icons } from '@superset-ui/core/components/Icons';
+
+const PAGE_SIZE = 25;
+
+interface ThemesListProps {
+  addDangerToast: (msg: string) => void;
+  addSuccessToast: (msg: string) => void;
+  user: {
+    userId: string | number;
+    firstName: string;
+    lastName: string;
+  };
+}
+
+function ThemesList({
+  addDangerToast,
+  addSuccessToast,
+  user,
+}: ThemesListProps) {
+  const {
+    state: {
+      loading,
+      resourceCount: themesCount,
+      resourceCollection: themes,
+      bulkSelectEnabled,
+    },
+    hasPerm,
+    fetchData,
+    refreshData,
+    toggleBulkSelect,
+  } = useListViewResource<ThemeObject>('theme', t('Themes'), addDangerToast);
+  const [themeModalOpen, setThemeModalOpen] = useState<boolean>(false);
+  const [currentTheme, setCurrentTheme] = useState<ThemeObject | null>(null);
+
+  const canCreate = hasPerm('can_write');
+  const canEdit = hasPerm('can_write');
+  const canDelete = hasPerm('can_write');
+
+  const [themeCurrentlyDeleting, setThemeCurrentlyDeleting] =
+    useState<ThemeObject | null>(null);
+
+  const handleThemeDelete = ({ id, theme_name }: ThemeObject) => {
+    SupersetClient.delete({
+      endpoint: `/api/v1/theme/${id}`,
+    }).then(
+      () => {
+        refreshData();
+        setThemeCurrentlyDeleting(null);
+        addSuccessToast(t('Deleted: %s', theme_name));
+      },
+      createErrorHandler(errMsg =>
+        addDangerToast(
+          t('There was an issue deleting %s: %s', theme_name, errMsg),
+        ),
+      ),
+    );
+  };
+
+  const handleBulkThemeDelete = (themesToDelete: ThemeObject[]) => {
+    SupersetClient.delete({
+      endpoint: `/api/v1/theme/?q=${rison.encode(
+        themesToDelete.map(({ id }) => id),
+      )}`,
+    }).then(
+      ({ json = {} }) => {
+        refreshData();
+        addSuccessToast(json.message);
+      },
+      createErrorHandler(errMsg =>
+        addDangerToast(
+          t('There was an issue deleting the selected themes: %s', errMsg),
+        ),
+      ),
+    );
+  };
+
+  function handleThemeEdit(themeObj: ThemeObject) {
+    setCurrentTheme(themeObj);
+    setThemeModalOpen(true);
+  }
+
+  const initialSort = [{ id: 'theme_name', desc: true }];
+  const columns = useMemo(
+    () => [
+      {
+        accessor: 'theme_name',
+        Header: t('Name'),
+        id: 'theme_name',
+      },
+      {
+        Cell: ({
+          row: {
+            original: {
+              changed_on_delta_humanized: changedOn,
+              changed_by: changedBy,
+            },
+          },
+        }: any) => <ModifiedInfo date={changedOn} user={changedBy} />,
+        Header: t('Last modified'),
+        accessor: 'changed_on_delta_humanized',
+        size: 'xl',
+        disableSortBy: true,
+        id: 'changed_on_delta_humanized',
+      },
+      {
+        Cell: ({ row: { original } }: any) => {
+          const handleEdit = () => handleThemeEdit(original);
+          const handleDelete = () => setThemeCurrentlyDeleting(original);
+
+          const actions = [
+            canEdit
+              ? {
+                  label: 'edit-action',
+                  tooltip: t('Edit theme'),
+                  placement: 'bottom',
+                  icon: 'EditOutlined',
+                  onClick: handleEdit,
+                }
+              : null,
+            canDelete
+              ? {
+                  label: 'delete-action',
+                  tooltip: t('Delete theme'),
+                  placement: 'bottom',
+                  icon: 'DeleteOutlined',
+                  onClick: handleDelete,
+                }
+              : null,
+          ].filter(item => !!item);
+
+          return (
+            <ListViewActionsBar actions={actions as ListViewActionProps[]} />
+          );
+        },
+        Header: t('Actions'),
+        id: 'actions',
+        disableSortBy: true,
+        hidden: !canEdit && !canDelete,
+        size: 'xl',
+      },
+      {
+        accessor: QueryObjectColumns.ChangedBy,
+        hidden: true,
+        id: QueryObjectColumns.ChangedBy,
+      },
+    ],
+    [canDelete, canCreate],
+  );
+
+  const menuData: SubMenuProps = {
+    name: t('Themes'),
+  };
+
+  const subMenuButtons: SubMenuProps['buttons'] = [];
+
+  if (canCreate) {
+    subMenuButtons.push({
+      name: <>{t('Theme')}</>,
+      buttonStyle: 'primary',
+      icon: <Icons.PlusOutlined iconSize="m" />,
+      onClick: () => {
+        setCurrentTheme(null);
+        setThemeModalOpen(true);
+      },
+    });
+  }
+
+  if (canDelete) {
+    subMenuButtons.push({
+      name: t('Bulk select'),
+      onClick: toggleBulkSelect,
+      buttonStyle: 'secondary',
+    });
+  }
+
+  menuData.buttons = subMenuButtons;
+
+  const filters: ListViewFilters = useMemo(
+    () => [
+      {
+        Header: t('Name'),
+        key: 'search',
+        id: 'theme_name',
+        input: 'search',
+        operator: FilterOperator.Contains,
+      },
+      {
+        Header: t('Modified by'),
+        key: 'changed_by',
+        id: 'changed_by',
+        input: 'select',
+        operator: FilterOperator.RelationOneMany,
+        unfilteredLabel: t('All'),
+        fetchSelects: createFetchRelated(
+          'theme',
+          'changed_by',
+          createErrorHandler(errMsg =>
+            t(
+              'An error occurred while fetching theme datasource values: %s',
+              errMsg,
+            ),
+          ),
+          user,
+        ),
+        paginate: true,
+      },
+    ],
+    [],
+  );
+
+  return (
+    <>
+      <SubMenu {...menuData} />
+      <ThemeModal
+        addDangerToast={addDangerToast}
+        theme={currentTheme}
+        onThemeAdd={() => refreshData()}
+        onHide={() => setThemeModalOpen(false)}
+        show={themeModalOpen}
+      />
+      {themeCurrentlyDeleting && (
+        <DeleteModal
+          description={t('This action will permanently delete the theme.')}
+          onConfirm={() => {
+            if (themeCurrentlyDeleting) {
+              handleThemeDelete(themeCurrentlyDeleting);
+            }
+          }}
+          onHide={() => setThemeCurrentlyDeleting(null)}
+          open
+          title={t('Delete Theme?')}
+        />
+      )}
+      <ConfirmStatusChange
+        title={t('Please confirm')}
+        description={t('Are you sure you want to delete the selected themes?')}
+        onConfirm={handleBulkThemeDelete}
+      >
+        {confirmDelete => {
+          const bulkActions: ListViewProps['bulkActions'] = canDelete
+            ? [
+                {
+                  key: 'delete',
+                  name: t('Delete'),
+                  onSelect: confirmDelete,
+                  type: 'danger',
+                },
+              ]
+            : [];
+
+          return (
+            <ListView<ThemeObject>
+              className="themes-list-view"
+              columns={columns}
+              count={themesCount}
+              data={themes}
+              fetchData={fetchData}
+              filters={filters}
+              initialSort={initialSort}
+              loading={loading}
+              pageSize={PAGE_SIZE}
+              bulkActions={bulkActions}
+              bulkSelectEnabled={bulkSelectEnabled}
+              disableBulkSelect={toggleBulkSelect}
+              addDangerToast={addDangerToast}
+              addSuccessToast={addSuccessToast}
+              refreshData={refreshData}
+            />
+          );
+        }}
+      </ConfirmStatusChange>
+    </>
+  );
+}
+
+export default withToasts(ThemesList);
diff --git a/superset-frontend/src/theme/ThemeController.ts b/superset-frontend/src/theme/ThemeController.ts
index d3672092a3..b7d9e1a13f 100644
--- a/superset-frontend/src/theme/ThemeController.ts
+++ b/superset-frontend/src/theme/ThemeController.ts
@@ -43,6 +43,8 @@ const DEFAULT_THEME_SETTINGS = {
 
 const STORAGE_KEYS = {
   THEME_MODE: 'superset-theme-mode',
+  CRUD_THEME_ID: 'superset-crud-theme-id',
+  DEV_THEME_OVERRIDE: 'superset-dev-theme-override',
 } as const;
 
 const MEDIA_QUERY_DARK_SCHEME = '(prefers-color-scheme: dark)';
@@ -97,6 +99,10 @@ export class ThemeController {
 
   private mediaQuery: MediaQueryList;
 
+  private crudThemeId: string | null = null;
+
+  private devThemeOverride: AnyThemeConfig | null = null;
+
   constructor(options: ThemeControllerOptions = {}) {
     const {
       storage = new LocalStorageAdapter(),
@@ -137,6 +143,10 @@ export class ThemeController {
     if (this.shouldInitializeMediaQueryListener())
       this.initializeMediaQueryListener();
 
+    // Load CRUD theme and dev override from storage
+    this.loadCrudThemeId();
+    this.loadDevThemeOverride();
+
     // Initialize theme and mode
     this.currentMode = this.determineInitialMode();
     const { theme, themeObject } =
@@ -236,6 +246,76 @@ export class ThemeController {
     this.updateTheme(defaultTheme);
   }
 
+  /**
+   * Sets a CRUD theme by UUID. This will fetch the theme from the API and apply it.
+   * @param themeUuid - The UUID of the CRUD theme to apply
+   */
+  public async setCrudTheme(themeUuid: string | null): Promise<void> {
+    this.crudThemeId = themeUuid;
+
+    if (themeUuid) {
+      this.storage.setItem(STORAGE_KEYS.CRUD_THEME_ID, themeUuid);
+      try {
+        const themeConfig = await this.fetchCrudTheme(themeUuid);
+        if (themeConfig) {
+          this.updateTheme(themeConfig);
+        }
+      } catch (error) {
+        console.error('Failed to load CRUD theme:', error);
+        this.fallbackToDefaultMode();
+      }
+    } else {
+      this.storage.removeItem(STORAGE_KEYS.CRUD_THEME_ID);
+      this.resetTheme();
+    }
+  }
+
+  /**
+   * Sets a temporary theme override for development purposes.
+   * This does not persist the theme but allows live preview.
+   * @param theme - The theme configuration to apply temporarily
+   */
+  public setTemporaryTheme(theme: AnyThemeConfig): void {
+    this.validateThemeUpdatePermission();
+
+    this.devThemeOverride = theme;
+    this.storage.setItem(
+      STORAGE_KEYS.DEV_THEME_OVERRIDE,
+      JSON.stringify(theme),
+    );
+
+    const normalizedTheme = this.normalizeTheme(theme);
+    this.updateTheme(normalizedTheme);
+  }
+
+  /**
+   * Clears all local overrides and CRUD theme selections.
+   * This allows developers to see what regular users see.
+   */
+  public clearLocalOverrides(): void {
+    this.devThemeOverride = null;
+    this.crudThemeId = null;
+
+    this.storage.removeItem(STORAGE_KEYS.DEV_THEME_OVERRIDE);
+    this.storage.removeItem(STORAGE_KEYS.CRUD_THEME_ID);
+
+    this.resetTheme();
+  }
+
+  /**
+   * Gets the current CRUD theme ID if any is selected.
+   */
+  public getCurrentCrudThemeId(): string | null {
+    return this.crudThemeId;
+  }
+
+  /**
+   * Checks if there's a development theme override active.
+   */
+  public hasDevOverride(): boolean {
+    return this.devThemeOverride !== null;
+  }
+
   /**
    * Handles system theme changes with error recovery.
    */
@@ -396,6 +476,20 @@ export class ThemeController {
    * @returns The theme configuration for the specified mode or null if not available
    */
   private getThemeForMode(mode: ThemeMode): AnyThemeConfig | null {
+    // Priority 1: Dev theme override (highest priority for development)
+    if (this.devThemeOverride) {
+      return this.devThemeOverride;
+    }
+
+    // Priority 2: CRUD theme (organizational themes)
+    if (this.crudThemeId) {
+      // For CRUD themes, we'll need to fetch them async, so return null here
+      // and let the async setCrudTheme handle the loading
+      // This is a simplification - in practice, we'd cache the CRUD theme
+      return null;
+    }
+
+    // Priority 3: Default theme system (existing logic)
     const { allowOSPreference = DEFAULT_THEME_SETTINGS.allowOSPreference } =
       this.themeSettings;
 
@@ -604,4 +698,55 @@ export class ThemeController {
       return ThemeMode.DEFAULT;
     }
   }
+
+  /**
+   * Loads the saved CRUD theme ID from storage.
+   */
+  private loadCrudThemeId(): void {
+    try {
+      this.crudThemeId = this.storage.getItem(STORAGE_KEYS.CRUD_THEME_ID);
+    } catch (error) {
+      console.warn('Failed to load CRUD theme ID:', error);
+      this.crudThemeId = null;
+    }
+  }
+
+  /**
+   * Loads the saved development theme override from storage.
+   */
+  private loadDevThemeOverride(): void {
+    try {
+      const stored = this.storage.getItem(STORAGE_KEYS.DEV_THEME_OVERRIDE);
+      if (stored) {
+        this.devThemeOverride = JSON.parse(stored);
+      }
+    } catch (error) {
+      console.warn('Failed to load dev theme override:', error);
+      this.devThemeOverride = null;
+    }
+  }
+
+  /**
+   * Fetches a theme configuration from the CRUD API.
+   * @param themeId - The ID of the theme to fetch
+   * @returns The theme configuration or null if not found
+   */
+  private async fetchCrudTheme(
+    themeUuid: string,
+  ): Promise<AnyThemeConfig | null> {
+    try {
+      const response = await fetch(`/api/v1/theme/${themeUuid}`);
+      if (!response.ok) {
+        throw new Error(`HTTP ${response.status}: ${response.statusText}`);
+      }
+
+      const data = await response.json();
+      const themeConfig = JSON.parse(data.result.json_data);
+
+      return themeConfig;
+    } catch (error) {
+      console.error('Failed to fetch CRUD theme:', error);
+      return null;
+    }
+  }
 }
diff --git a/superset-frontend/src/theme/ThemeProvider.tsx b/superset-frontend/src/theme/ThemeProvider.tsx
index 219c3c83a8..c9ed269c61 100644
--- a/superset-frontend/src/theme/ThemeProvider.tsx
+++ b/superset-frontend/src/theme/ThemeProvider.tsx
@@ -71,6 +71,31 @@ export function SupersetThemeProvider({
     [themeController],
   );
 
+  const setCrudTheme = useCallback(
+    (themeId: string | null) => themeController.setCrudTheme(themeId),
+    [themeController],
+  );
+
+  const setTemporaryTheme = useCallback(
+    (config: AnyThemeConfig) => themeController.setTemporaryTheme(config),
+    [themeController],
+  );
+
+  const clearLocalOverrides = useCallback(
+    () => themeController.clearLocalOverrides(),
+    [themeController],
+  );
+
+  const getCurrentCrudThemeId = useCallback(
+    () => themeController.getCurrentCrudThemeId(),
+    [themeController],
+  );
+
+  const hasDevOverride = useCallback(
+    () => themeController.hasDevOverride(),
+    [themeController],
+  );
+
   const contextValue = useMemo(
     () => ({
       theme: currentTheme,
@@ -78,8 +103,24 @@ export function SupersetThemeProvider({
       setTheme,
       setThemeMode,
       resetTheme,
+      setCrudTheme,
+      setTemporaryTheme,
+      clearLocalOverrides,
+      getCurrentCrudThemeId,
+      hasDevOverride,
     }),
-    [currentTheme, currentThemeMode, setTheme, setThemeMode, resetTheme],
+    [
+      currentTheme,
+      currentThemeMode,
+      setTheme,
+      setThemeMode,
+      resetTheme,
+      setCrudTheme,
+      setTemporaryTheme,
+      clearLocalOverrides,
+      getCurrentCrudThemeId,
+      hasDevOverride,
+    ],
   );
 
   return (
diff --git a/superset-frontend/src/views/routes.tsx b/superset-frontend/src/views/routes.tsx
index 332aa0caf1..b6bf88d887 100644
--- a/superset-frontend/src/views/routes.tsx
+++ b/superset-frontend/src/views/routes.tsx
@@ -64,6 +64,10 @@ const CssTemplateList = lazy(
     ),
 );
 
+const ThemeList = lazy(
+  () => import(/* webpackChunkName: "ThemeList" */ 'src/pages/ThemeList'),
+);
+
 const DashboardList = lazy(
   () =>
     import(/* webpackChunkName: "DashboardList" */ 'src/pages/DashboardList'),
@@ -223,6 +227,10 @@ export const routes: Routes = [
     path: '/csstemplatemodelview/list/',
     Component: CssTemplateList,
   },
+  {
+    path: '/thememodelview/list/',
+    Component: ThemeList,
+  },
   {
     path: '/annotationlayer/list/',
     Component: AnnotationLayerList,
diff --git a/superset/commands/theme/__init__.py b/superset/commands/theme/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/superset/commands/theme/delete.py b/superset/commands/theme/delete.py
new file mode 100644
index 0000000000..9744cfab96
--- /dev/null
+++ b/superset/commands/theme/delete.py
@@ -0,0 +1,48 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import logging
+from functools import partial
+from typing import Optional
+
+from superset.commands.base import BaseCommand
+from superset.commands.theme.exceptions import (
+    ThemeDeleteFailedError,
+    ThemeNotFoundError,
+)
+from superset.daos.theme import ThemeDAO
+from superset.models.core import Theme
+from superset.utils.decorators import on_error, transaction
+
+logger = logging.getLogger(__name__)
+
+
+class DeleteThemeCommand(BaseCommand):
+    def __init__(self, model_ids: list[int]):
+        self._model_ids = model_ids
+        self._models: Optional[list[Theme]] = None
+
+    @transaction(on_error=partial(on_error, reraise=ThemeDeleteFailedError))
+    def run(self) -> None:
+        self.validate()
+        assert self._models
+        ThemeDAO.delete(self._models)
+
+    def validate(self) -> None:
+        # Validate/populate model exists
+        self._models = ThemeDAO.find_by_ids(self._model_ids)
+        if not self._models or len(self._models) != len(self._model_ids):
+            raise ThemeNotFoundError()
diff --git a/superset/commands/theme/exceptions.py b/superset/commands/theme/exceptions.py
new file mode 100644
index 0000000000..d549020e26
--- /dev/null
+++ b/superset/commands/theme/exceptions.py
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from flask_babel import lazy_gettext as _
+
+from superset.commands.exceptions import CommandException, DeleteFailedError
+
+
+class ThemeDeleteFailedError(DeleteFailedError):
+    message = _("Themes could not be deleted.")
+
+
+class ThemeNotFoundError(CommandException):
+    message = _("Theme not found.")
diff --git a/superset/config.py b/superset/config.py
index cf27c36f23..6d8edb8599 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -575,7 +575,7 @@ DEFAULT_FEATURE_FLAGS: dict[str, bool] = {
     # and see the changes applied to the current theme.
     # This is intended to use for theme creation, visual review and theming-debugging
     # purposes.
-    "THEME_ALLOW_THEME_EDITOR_BETA": False,
+    "THEME_ALLOW_THEME_EDITOR_BETA": True,
     # Allow users to optionally specify date formats in email subjects, which will
     # be parsed if enabled
     "DATE_FORMAT_IN_EMAIL_SUBJECT": False,
diff --git a/superset/daos/theme.py b/superset/daos/theme.py
new file mode 100644
index 0000000000..f0b4085a1f
--- /dev/null
+++ b/superset/daos/theme.py
@@ -0,0 +1,28 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from typing import Optional
+
+from superset.daos.base import BaseDAO
+from superset.extensions import db
+from superset.models.core import Theme
+
+
+class ThemeDAO(BaseDAO[Theme]):
+    @classmethod
+    def find_by_uuid(cls, uuid: str) -> Optional[Theme]:
+        """Find theme by UUID."""
+        return db.session.query(Theme).filter(Theme.uuid == uuid).first()
diff --git a/superset/initialization/__init__.py b/superset/initialization/__init__.py
index 9bb34ee864..268dffd636 100644
--- a/superset/initialization/__init__.py
+++ b/superset/initialization/__init__.py
@@ -161,6 +161,7 @@ class SupersetAppInitializer:  # pylint: disable=too-many-public-methods
         from superset.sqllab.api import SqlLabRestApi
         from superset.sqllab.permalink.api import SqlLabPermalinkRestApi
         from superset.tags.api import TagRestApi
+        from superset.themes.api import ThemeRestApi
         from superset.views.alerts import AlertView, ReportView
         from superset.views.all_entities import TaggedObjectsModelView
         from superset.views.annotations import AnnotationLayerView
@@ -192,6 +193,7 @@ class SupersetAppInitializer:  # pylint: disable=too-many-public-methods
         )
         from superset.views.sqllab import SqllabView
         from superset.views.tags import TagModelView, TagView
+        from superset.views.themes import ThemeModelView
         from superset.views.user_info import UserInfoView
         from superset.views.user_registrations import UserRegistrationsView
         from superset.views.users.api import CurrentUserRestApi, UserRestApi
@@ -211,6 +213,7 @@ class SupersetAppInitializer:  # pylint: disable=too-many-public-methods
         appbuilder.add_api(ChartRestApi)
         appbuilder.add_api(ChartDataRestApi)
         appbuilder.add_api(CssTemplateRestApi)
+        appbuilder.add_api(ThemeRestApi)
         appbuilder.add_api(CurrentUserRestApi)
         appbuilder.add_api(UserRestApi)
         appbuilder.add_api(DashboardFilterStateRestApi)
@@ -345,6 +348,15 @@ class SupersetAppInitializer:  # pylint: disable=too-many-public-methods
             category_label=_("Manage"),
             category_icon="",
         )
+        appbuilder.add_view(
+            ThemeModelView,
+            "Themes",
+            label=_("Themes"),
+            icon="fa-palette",
+            category="Manage",
+            category_label=_("Manage"),
+            category_icon="",
+        )
 
         #
         # Setup views with no menu
diff --git a/superset/migrations/versions/2025-07-15_16-40_3fd555e76e3d_theme_crud.py b/superset/migrations/versions/2025-07-15_16-40_3fd555e76e3d_theme_crud.py
new file mode 100644
index 0000000000..13b5f739b7
--- /dev/null
+++ b/superset/migrations/versions/2025-07-15_16-40_3fd555e76e3d_theme_crud.py
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""theme_crud
+
+Revision ID: 3fd555e76e3d
+Revises: 363a9b1e8992
+Create Date: 2025-07-15 16:40:35.166210
+
+"""
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy.dialects import mysql
+from sqlalchemy_utils import UUIDType
+
+# revision identifiers, used by Alembic.
+revision = "3fd555e76e3d"
+down_revision = "363a9b1e8992"
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.create_table(
+        "themes",
+        sa.Column("uuid", UUIDType(), nullable=True),
+        sa.Column("created_on", sa.DateTime(), nullable=True),
+        sa.Column("changed_on", sa.DateTime(), nullable=True),
+        sa.Column("id", sa.Integer(), nullable=False),
+        sa.Column("theme_name", sa.String(length=250), nullable=True),
+        sa.Column(
+            "json_data",
+            sa.Text().with_variant(mysql.MEDIUMTEXT(), "mysql"),
+            nullable=True,
+        ),
+        sa.Column("created_by_fk", sa.Integer(), nullable=True),
+        sa.Column("changed_by_fk", sa.Integer(), nullable=True),
+        sa.ForeignKeyConstraint(
+            ["changed_by_fk"],
+            ["ab_user.id"],
+        ),
+        sa.ForeignKeyConstraint(
+            ["created_by_fk"],
+            ["ab_user.id"],
+        ),
+        sa.PrimaryKeyConstraint("id"),
+        sa.UniqueConstraint("uuid"),
+    )
+
+
+def downgrade():
+    op.drop_table("themes")
diff --git a/superset/models/core.py b/superset/models/core.py
index 787c380bea..1c9e295f3c 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -121,6 +121,17 @@ class CssTemplate(AuditMixinNullable, UUIDMixin, Model):
     css = Column(utils.MediumText(), default="")
 
 
+class Theme(AuditMixinNullable, ImportExportMixin, Model):
+    """Themes for dashboards"""
+
+    __tablename__ = "themes"
+    id = Column(Integer, primary_key=True)
+    theme_name = Column(String(250))
+    json_data = Column(utils.MediumText(), default="")
+
+    export_fields = ["theme_name", "json_data"]
+
+
 class ConfigurationMethod(StrEnum):
     SQLALCHEMY_FORM = "sqlalchemy_form"
     DYNAMIC_FORM = "dynamic_form"
diff --git a/superset/themes/api.py b/superset/themes/api.py
new file mode 100644
index 0000000000..212828537d
--- /dev/null
+++ b/superset/themes/api.py
@@ -0,0 +1,316 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import logging
+from typing import Any
+
+from flask import Response
+from flask_appbuilder.api import expose, protect, rison, safe
+from flask_appbuilder.models.sqla.interface import SQLAInterface
+from flask_babel import ngettext
+
+from superset.commands.theme.delete import DeleteThemeCommand
+from superset.commands.theme.exceptions import (
+    ThemeDeleteFailedError,
+    ThemeNotFoundError,
+)
+from superset.constants import MODEL_API_RW_METHOD_PERMISSION_MAP, RouteMethod
+from superset.daos.theme import ThemeDAO
+from superset.extensions import event_logger
+from superset.models.core import Theme
+from superset.themes.filters import ThemeAllTextFilter
+from superset.themes.schemas import (
+    get_delete_ids_schema,
+    openapi_spec_methods_override,
+)
+from superset.views.base_api import (
+    BaseSupersetModelRestApi,
+    RelatedFieldFilter,
+    statsd_metrics,
+)
+from superset.views.filters import BaseFilterRelatedUsers, FilterRelatedOwners
+
+logger = logging.getLogger(__name__)
+
+
+class ThemeRestApi(BaseSupersetModelRestApi):
+    datamodel = SQLAInterface(Theme)
+
+    include_route_methods = RouteMethod.REST_MODEL_VIEW_CRUD_SET | {
+        RouteMethod.EXPORT,
+        RouteMethod.IMPORT,
+        RouteMethod.RELATED,
+        "bulk_delete",  # not using RouteMethod since locally defined
+    }
+    class_permission_name = "Theme"
+    method_permission_name = MODEL_API_RW_METHOD_PERMISSION_MAP
+
+    resource_name = "theme"
+    allow_browser_login = True
+
+    show_columns = [
+        "changed_on_delta_humanized",
+        "changed_by.first_name",
+        "changed_by.id",
+        "changed_by.last_name",
+        "created_by.first_name",
+        "created_by.id",
+        "created_by.last_name",
+        "json_data",
+        "uuid",
+        "theme_name",
+    ]
+    list_columns = [
+        "changed_on_delta_humanized",
+        "changed_by.first_name",
+        "changed_by.id",
+        "changed_by.last_name",
+        "created_on",
+        "created_by.first_name",
+        "created_by.id",
+        "created_by.last_name",
+        "json_data",
+        "uuid",
+        "theme_name",
+    ]
+    add_columns = ["json_data", "theme_name"]
+    edit_columns = add_columns
+    order_columns = ["theme_name"]
+
+    search_filters = {"theme_name": [ThemeAllTextFilter]}
+    allowed_rel_fields = {"created_by", "changed_by"}
+
+    apispec_parameter_schemas = {
+        "get_delete_ids_schema": get_delete_ids_schema,
+    }
+    openapi_spec_tag = "Themes"
+    openapi_spec_methods = openapi_spec_methods_override
+
+    related_field_filters = {
+        "changed_by": RelatedFieldFilter("first_name", FilterRelatedOwners),
+    }
+    base_related_field_filters = {
+        "changed_by": [["id", BaseFilterRelatedUsers, lambda: []]],
+    }
+
+    @expose("/", methods=("DELETE",))
+    @protect()
+    @safe
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.bulk_delete",
+        log_to_statsd=False,
+    )
+    @rison(get_delete_ids_schema)
+    def bulk_delete(self, **kwargs: Any) -> Response:
+        """Bulk delete themes.
+        ---
+        delete:
+          summary: Bulk delete themes
+          parameters:
+          - in: query
+            name: q
+            content:
+              application/json:
+                schema:
+                  $ref: '#/components/schemas/get_delete_ids_schema'
+          responses:
+            200:
+              description: Themes bulk delete
+              content:
+                application/json:
+                  schema:
+                    type: object
+                    properties:
+                      message:
+                        type: string
+            401:
+              $ref: '#/components/responses/401'
+            404:
+              $ref: '#/components/responses/404'
+            422:
+              $ref: '#/components/responses/422'
+            500:
+              $ref: '#/components/responses/500'
+        """
+        item_ids = kwargs["rison"]
+        try:
+            DeleteThemeCommand(item_ids).run()
+            return self.response(
+                200,
+                message=ngettext(
+                    "Deleted %(num)d theme",
+                    "Deleted %(num)d themes",
+                    num=len(item_ids),
+                ),
+            )
+        except ThemeNotFoundError:
+            return self.response_404()
+        except ThemeDeleteFailedError as ex:
+            return self.response_422(message=str(ex))
+
+    @expose("/<uuid>", methods=("GET",))
+    @protect()
+    @safe
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.get_by_uuid",
+        log_to_statsd=False,
+    )
+    def get(self, uuid: str) -> Response:  # pylint: disable=arguments-differ
+        """Get theme by UUID.
+        ---
+        get:
+          summary: Get theme by UUID
+          parameters:
+          - in: path
+            schema:
+              type: string
+            name: uuid
+            description: The theme UUID
+          responses:
+            200:
+              description: Theme details
+              content:
+                application/json:
+                  schema:
+                    type: object
+                    properties:
+                      result:
+                        $ref: '#/components/schemas/ThemeRestApi.get'
+            401:
+              $ref: '#/components/responses/401'
+            404:
+              $ref: '#/components/responses/404'
+            500:
+              $ref: '#/components/responses/500'
+        """
+        try:
+            theme = ThemeDAO.find_by_uuid(uuid)
+            if not theme:
+                return self.response_404()
+            return self.response(200, **self.show(theme.id))
+        except Exception as ex:
+            logger.exception(ex)
+            return self.response_500()
+
+    @expose("/<uuid>", methods=("PUT",))
+    @protect()
+    @safe
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.put_by_uuid",
+        log_to_statsd=False,
+    )
+    def put(self, uuid: str) -> Response:  # pylint: disable=arguments-differ
+        """Update theme by UUID.
+        ---
+        put:
+          summary: Update theme by UUID
+          parameters:
+          - in: path
+            schema:
+              type: string
+            name: uuid
+            description: The theme UUID
+          requestBody:
+            description: Theme schema
+            required: true
+            content:
+              application/json:
+                schema:
+                  $ref: '#/components/schemas/ThemeRestApi.put'
+          responses:
+            200:
+              description: Theme updated
+              content:
+                application/json:
+                  schema:
+                    type: object
+                    properties:
+                      result:
+                        $ref: '#/components/schemas/ThemeRestApi.put'
+            400:
+              $ref: '#/components/responses/400'
+            401:
+              $ref: '#/components/responses/401'
+            404:
+              $ref: '#/components/responses/404'
+            422:
+              $ref: '#/components/responses/422'
+            500:
+              $ref: '#/components/responses/500'
+        """
+        try:
+            theme = ThemeDAO.find_by_uuid(uuid)
+            if not theme:
+                return self.response_404()
+            return self.edit(theme.id)
+        except Exception as ex:
+            logger.exception(ex)
+            return self.response_500()
+
+    @expose("/<uuid>", methods=("DELETE",))
+    @protect()
+    @safe
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self,
+        *args,
+        **kwargs: f"{self.__class__.__name__}.delete_by_uuid",
+        log_to_statsd=False,
+    )
+    def delete(self, uuid: str) -> Response:  # pylint: disable=arguments-differ
+        """Delete theme by UUID.
+        ---
+        delete:
+          summary: Delete theme by UUID
+          parameters:
+          - in: path
+            schema:
+              type: string
+            name: uuid
+            description: The theme UUID
+          responses:
+            200:
+              description: Theme deleted
+              content:
+                application/json:
+                  schema:
+                    type: object
+                    properties:
+                      message:
+                        type: string
+            401:
+              $ref: '#/components/responses/401'
+            404:
+              $ref: '#/components/responses/404'
+            422:
+              $ref: '#/components/responses/422'
+            500:
+              $ref: '#/components/responses/500'
+        """
+        try:
+            theme = ThemeDAO.find_by_uuid(uuid)
+            if not theme:
+                return self.response_404()
+            DeleteThemeCommand([theme.id]).run()
+            return self.response(200, message="Theme deleted")
+        except ThemeDeleteFailedError as ex:
+            return self.response_422(message=str(ex))
+        except Exception as ex:
+            logger.exception(ex)
+            return self.response_500()
diff --git a/superset/themes/filters.py b/superset/themes/filters.py
new file mode 100644
index 0000000000..680fb8277b
--- /dev/null
+++ b/superset/themes/filters.py
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from typing import Any
+
+from flask_babel import lazy_gettext as _
+from sqlalchemy import or_
+from sqlalchemy.orm.query import Query
+
+from superset.models.core import Theme
+from superset.views.base import BaseFilter
+
+
+class ThemeAllTextFilter(BaseFilter):  # pylint: disable=too-few-public-methods
+    name = _("All Text")
+    arg_name = "theme_all_text"
+
+    def apply(self, query: Query, value: Any) -> Query:
+        if not value:
+            return query
+        ilike_value = f"%{value}%"
+        return query.filter(
+            or_(
+                Theme.theme_name.ilike(ilike_value),
+                Theme.json_data.ilike(ilike_value),
+            )
+        )
diff --git a/superset/themes/schemas.py b/superset/themes/schemas.py
new file mode 100644
index 0000000000..e26ce5a2e1
--- /dev/null
+++ b/superset/themes/schemas.py
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+openapi_spec_methods_override = {
+    "get": {"get": {"summary": "Get a theme"}},
+    "get_list": {
+        "get": {
+            "summary": "Get a list of themes",
+            "description": "Gets a list of themes, use Rison or JSON "
+            "query parameters for filtering, sorting,"
+            " pagination and for selecting specific"
+            " columns and metadata.",
+        }
+    },
+    "post": {"post": {"summary": "Create a theme"}},
+    "put": {"put": {"summary": "Update a theme"}},
+    "delete": {"delete": {"summary": "Delete a theme"}},
+    "info": {"get": {"summary": "Get metadata information about this API resource"}},
+}
+
+get_delete_ids_schema = {"type": "array", "items": {"type": "integer"}}
diff --git a/superset/views/themes.py b/superset/views/themes.py
new file mode 100644
index 0000000000..6cd6dd781c
--- /dev/null
+++ b/superset/views/themes.py
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from flask_appbuilder.api import expose
+from flask_appbuilder.models.sqla.interface import SQLAInterface
+from flask_appbuilder.security.decorators import has_access
+
+from superset.constants import MODEL_VIEW_RW_METHOD_PERMISSION_MAP, RouteMethod
+from superset.models import core as models
+from superset.superset_typing import FlaskResponse
+from superset.views.base import DeleteMixin, SupersetModelView
+
+
+class ThemeModelView(  # pylint: disable=too-many-ancestors
+    SupersetModelView,
+    DeleteMixin,
+):
+    datamodel = SQLAInterface(models.Theme)
+    include_route_methods = RouteMethod.LIST
+
+    class_permission_name = "Theme"
+    method_permission_name = MODEL_VIEW_RW_METHOD_PERMISSION_MAP
+
+    @expose("/list/")
+    @has_access
+    def list(self) -> FlaskResponse:
+        return super().render_app_template()
diff --git a/tests/integration_tests/themes/__init__.py b/tests/integration_tests/themes/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/integration_tests/themes/api_tests.py b/tests/integration_tests/themes/api_tests.py
new file mode 100644
index 0000000000..977e339818
--- /dev/null
+++ b/tests/integration_tests/themes/api_tests.py
@@ -0,0 +1,384 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# isort:skip_file
+"""Unit tests for Superset"""
+
+import pytest
+import prison
+from datetime import datetime
+from freezegun import freeze_time
+from sqlalchemy.sql import func
+
+import tests.integration_tests.test_app  # noqa: F401
+from superset import db
+from superset.models.core import Theme
+from superset.utils.database import get_example_database  # noqa: F401
+from superset.utils import json
+
+from tests.integration_tests.base_tests import SupersetTestCase
+from tests.integration_tests.constants import ADMIN_USERNAME
+
+THEMES_FIXTURE_COUNT = 3
+
+
+class TestThemeApi(SupersetTestCase):
+    def insert_theme(
+        self,
+        theme_name: str,
+        json_data: str,
+        created_by_username: str = "admin",
+    ) -> Theme:
+        admin = self.get_user(created_by_username)
+        theme = Theme(
+            theme_name=theme_name,
+            json_data=json_data,
+            created_by=admin,
+            changed_by=admin,
+        )
+        db.session.add(theme)
+        db.session.commit()
+        return theme
+
+    @pytest.fixture
+    def create_themes(self):
+        with self.create_app().app_context():
+            themes = []
+            for cx in range(THEMES_FIXTURE_COUNT):
+                themes.append(
+                    self.insert_theme(
+                        theme_name=f"theme_name{cx}",
+                        json_data=f'{{"color": "theme{cx}"}}',
+                    )
+                )
+            yield themes
+
+            # rollback changes
+            for theme in themes:
+                db.session.delete(theme)
+            db.session.commit()
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_get_list_theme(self):
+        """
+        Theme API: Test get list themes
+        """
+        themes = db.session.query(Theme).all()
+
+        self.login(ADMIN_USERNAME)
+        uri = "api/v1/theme/"
+        rv = self.get_assert_metric(uri, "get_list")
+        assert rv.status_code == 200
+        data = json.loads(rv.data.decode("utf-8"))
+        assert data["count"] == len(themes)
+        expected_columns = [
+            "changed_by",
+            "changed_on_delta_humanized",
+            "created_by",
+            "created_on",
+            "json_data",
+            "id",
+            "theme_name",
+        ]
+        result_columns = list(data["result"][0].keys())
+        result_columns.sort()
+        assert expected_columns == result_columns
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_get_list_sort_theme(self):
+        """
+        Theme API: Test get list and sort themes
+        """
+        themes = db.session.query(Theme).order_by(Theme.theme_name.asc()).all()
+        self.login(ADMIN_USERNAME)
+        query_string = {"order_column": "theme_name", "order_direction": "asc"}
+        uri = f"api/v1/theme/?q={prison.dumps(query_string)}"
+        rv = self.get_assert_metric(uri, "get_list")
+        assert rv.status_code == 200
+        data = json.loads(rv.data.decode("utf-8"))
+        assert data["count"] == len(themes)
+        for i, theme in enumerate(themes):
+            assert theme.theme_name == data["result"][i]["theme_name"]
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_get_list_custom_filter_theme(self):
+        """
+        Theme API: Test get list and custom filter
+        """
+        self.login(ADMIN_USERNAME)
+
+        # Test filtering by JSON data
+        all_themes = (
+            db.session.query(Theme).filter(Theme.json_data.ilike("%theme1%")).all()
+        )
+        query_string = {
+            "filters": [
+                {
+                    "col": "theme_name",
+                    "opr": "theme_all_text",
+                    "value": "theme1",
+                }
+            ],
+        }
+        uri = f"api/v1/theme/?q={prison.dumps(query_string)}"
+        rv = self.get_assert_metric(uri, "get_list")
+        assert rv.status_code == 200
+        data = json.loads(rv.data.decode("utf-8"))
+        assert data["count"] == len(all_themes)
+
+        # Test filtering by theme name
+        all_themes = (
+            db.session.query(Theme)
+            .filter(Theme.theme_name.ilike("%theme_name2%"))
+            .all()
+        )
+        query_string = {
+            "filters": [
+                {
+                    "col": "theme_name",
+                    "opr": "theme_all_text",
+                    "value": "theme_name2",
+                }
+            ],
+        }
+        uri = f"api/v1/theme/?q={prison.dumps(query_string)}"
+        rv = self.get_assert_metric(uri, "get_list")
+        assert rv.status_code == 200
+        data = json.loads(rv.data.decode("utf-8"))
+        assert data["count"] == len(all_themes)
+
+    def test_info_theme(self):
+        """
+        Theme API: Test info
+        """
+        self.login(ADMIN_USERNAME)
+        uri = "api/v1/theme/_info"
+        rv = self.get_assert_metric(uri, "info")
+        assert rv.status_code == 200
+
+    def test_info_security_theme(self):
+        """
+        Theme API: Test info security
+        """
+        self.login(ADMIN_USERNAME)
+        params = {"keys": ["permissions"]}
+        uri = f"api/v1/theme/_info?q={prison.dumps(params)}"
+        rv = self.get_assert_metric(uri, "info")
+        data = json.loads(rv.data.decode("utf-8"))
+        assert rv.status_code == 200
+        assert "can_read" in data["permissions"]
+        assert "can_write" in data["permissions"]
+        assert len(data["permissions"]) == 2
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_get_theme(self):
+        """
+        Theme API: Test get theme
+        """
+        with freeze_time(datetime.now()):
+            theme = (
+                db.session.query(Theme)
+                .filter(Theme.theme_name == "theme_name1")
+                .one_or_none()
+            )
+            self.login(ADMIN_USERNAME)
+            uri = f"api/v1/theme/{theme.id}"
+            rv = self.get_assert_metric(uri, "get")
+        assert rv.status_code == 200
+
+        expected_result = {
+            "id": theme.id,
+            "theme_name": "theme_name1",
+            "json_data": '{"color": "theme1"}',
+            "changed_by": {
+                "first_name": theme.created_by.first_name,
+                "id": theme.created_by.id,
+                "last_name": theme.created_by.last_name,
+            },
+            "changed_on_delta_humanized": "now",
+            "created_by": {
+                "first_name": theme.created_by.first_name,
+                "id": theme.created_by.id,
+                "last_name": theme.created_by.last_name,
+            },
+        }
+        data = json.loads(rv.data.decode("utf-8"))
+        for key, value in data["result"].items():
+            assert value == expected_result[key]
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_get_theme_not_found(self):
+        """
+        Theme API: Test get theme not found
+        """
+        max_id = db.session.query(func.max(Theme.id)).scalar()
+        self.login(ADMIN_USERNAME)
+        uri = f"api/v1/theme/{max_id + 1}"
+        rv = self.get_assert_metric(uri, "get")
+        assert rv.status_code == 404
+
+    def test_create_theme(self):
+        """
+        Theme API: Test create
+        """
+        post_data = {
+            "theme_name": "test_theme",
+            "json_data": '{"primary": "#007bff", "secondary": "#6c757d"}',
+        }
+
+        self.login(ADMIN_USERNAME)
+        uri = "api/v1/theme/"
+        rv = self.post_assert_metric(uri, post_data, "post")
+        data = json.loads(rv.data.decode("utf-8"))
+        assert rv.status_code == 201
+
+        theme_id = data.get("id")
+        model = db.session.query(Theme).get(theme_id)
+        for key in post_data:
+            assert getattr(model, key) == data["result"][key]
+
+        # Rollback changes
+        db.session.delete(model)
+        db.session.commit()
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_update_theme(self):
+        """
+        Theme API: Test update
+        """
+        theme = (
+            db.session.query(Theme).filter(Theme.theme_name == "theme_name1").all()[0]
+        )
+
+        put_data = {
+            "theme_name": "updated_theme_name",
+            "json_data": '{"primary": "#28a745", "secondary": "#ffc107"}',
+        }
+
+        self.login(ADMIN_USERNAME)
+        uri = f"api/v1/theme/{theme.id}"
+        rv = self.put_assert_metric(uri, put_data, "put")
+        assert rv.status_code == 200
+
+        model = db.session.query(Theme).get(theme.id)
+        assert model.theme_name == "updated_theme_name"
+        assert model.json_data == '{"primary": "#28a745", "secondary": "#ffc107"}'
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_update_theme_not_found(self):
+        """
+        Theme API: Test update not found
+        """
+        max_id = db.session.query(func.max(Theme.id)).scalar()
+        self.login(ADMIN_USERNAME)
+
+        put_data = {
+            "theme_name": "updated_theme_name",
+            "json_data": '{"primary": "#28a745"}',
+        }
+
+        uri = f"api/v1/theme/{max_id + 1}"
+        rv = self.put_assert_metric(uri, put_data, "put")
+        assert rv.status_code == 404
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_delete_theme(self):
+        """
+        Theme API: Test delete
+        """
+        theme = (
+            db.session.query(Theme)
+            .filter(Theme.theme_name == "theme_name1")
+            .one_or_none()
+        )
+
+        self.login(ADMIN_USERNAME)
+        uri = f"api/v1/theme/{theme.id}"
+        rv = self.delete_assert_metric(uri, "delete")
+        assert rv.status_code == 200
+
+        model = db.session.query(Theme).get(theme.id)
+        assert model is None
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_delete_theme_not_found(self):
+        """
+        Theme API: Test delete not found
+        """
+        max_id = db.session.query(func.max(Theme.id)).scalar()
+        self.login(ADMIN_USERNAME)
+        uri = f"api/v1/theme/{max_id + 1}"
+        rv = self.delete_assert_metric(uri, "delete")
+        assert rv.status_code == 404
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_delete_bulk_themes(self):
+        """
+        Theme API: Test delete bulk
+        """
+        themes = db.session.query(Theme).all()
+        theme_ids = [theme.id for theme in themes]
+
+        self.login(ADMIN_USERNAME)
+        uri = f"api/v1/theme/?q={prison.dumps(theme_ids)}"
+        rv = self.delete_assert_metric(uri, "bulk_delete")
+        assert rv.status_code == 200
+        response = json.loads(rv.data.decode("utf-8"))
+        expected_response = {"message": f"Deleted {len(theme_ids)} themes"}
+        assert response == expected_response
+        themes = db.session.query(Theme).all()
+        assert themes == []
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_delete_one_bulk_themes(self):
+        """
+        Theme API: Test delete one in bulk
+        """
+        theme = db.session.query(Theme).first()
+        theme_ids = [theme.id]
+
+        self.login(ADMIN_USERNAME)
+        uri = f"api/v1/theme/?q={prison.dumps(theme_ids)}"
+        rv = self.delete_assert_metric(uri, "bulk_delete")
+        assert rv.status_code == 200
+        response = json.loads(rv.data.decode("utf-8"))
+        expected_response = {"message": f"Deleted {len(theme_ids)} theme"}
+        assert response == expected_response
+        theme_ = db.session.query(Theme).get(theme_ids[0])
+        assert theme_ is None
+
+    def test_delete_bulk_theme_bad_request(self):
+        """
+        Theme API: Test delete bulk bad request
+        """
+        theme_ids = [1, "a"]
+        self.login(ADMIN_USERNAME)
+        uri = f"api/v1/theme/?q={prison.dumps(theme_ids)}"
+        rv = self.delete_assert_metric(uri, "bulk_delete")
+        assert rv.status_code == 400
+
+    @pytest.mark.usefixtures("create_themes")
+    def test_delete_bulk_theme_not_found(self):
+        """
+        Theme API: Test delete bulk not found
+        """
+        max_id = db.session.query(func.max(Theme.id)).scalar()
+
+        theme_ids = [max_id + 1, max_id + 2]
+        self.login(ADMIN_USERNAME)
+        uri = f"api/v1/theme/?q={prison.dumps(theme_ids)}"
+        rv = self.delete_assert_metric(uri, "bulk_delete")
+        assert rv.status_code == 404
diff --git a/tests/unit_tests/themes/__init__.py b/tests/unit_tests/themes/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/unit_tests/themes/api_test.py b/tests/unit_tests/themes/api_test.py
new file mode 100644
index 0000000000..0545d75cfd
--- /dev/null
+++ b/tests/unit_tests/themes/api_test.py
@@ -0,0 +1,94 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+from superset.themes.api import ThemeRestApi
+
+
+class TestThemeRestApi:
+    """Unit tests for ThemeRestApi class configuration"""
+
+    def test_resource_name(self):
+        """Test that resource name is set correctly"""
+        assert ThemeRestApi.resource_name == "theme"
+
+    def test_class_permission_name(self):
+        """Test that class permission name is set correctly"""
+        assert ThemeRestApi.class_permission_name == "Theme"
+
+    def test_datamodel_configured(self):
+        """Test that datamodel is configured with Theme model"""
+        # The datamodel is configured in __init__ so we can't test it directly
+        # but we can verify the configuration is correct
+        assert hasattr(ThemeRestApi, "datamodel")
+
+    def test_add_columns_configuration(self):
+        """Test that add columns are configured correctly"""
+        expected_columns = ["json_data", "theme_name"]
+        assert ThemeRestApi.add_columns == expected_columns
+
+    def test_edit_columns_configuration(self):
+        """Test that edit columns match add columns"""
+        assert ThemeRestApi.edit_columns == ThemeRestApi.add_columns
+
+    def test_show_columns_configuration(self):
+        """Test that show columns are configured correctly"""
+        expected_columns = [
+            "changed_on_delta_humanized",
+            "changed_by.first_name",
+            "changed_by.id",
+            "changed_by.last_name",
+            "created_by.first_name",
+            "created_by.id",
+            "created_by.last_name",
+            "json_data",
+            "id",
+            "theme_name",
+        ]
+        assert ThemeRestApi.show_columns == expected_columns
+
+    def test_list_columns_configuration(self):
+        """Test that list columns are configured correctly"""
+        expected_columns = [
+            "changed_on_delta_humanized",
+            "changed_by.first_name",
+            "changed_by.id",
+            "changed_by.last_name",
+            "created_on",
+            "created_by.first_name",
+            "created_by.id",
+            "created_by.last_name",
+            "json_data",
+            "id",
+            "theme_name",
+        ]
+        assert ThemeRestApi.list_columns == expected_columns
+
+    def test_order_columns_configuration(self):
+        """Test that order columns are configured correctly"""
+        expected_columns = ["theme_name"]
+        assert ThemeRestApi.order_columns == expected_columns
+
+    def test_openapi_spec_tag(self):
+        """Test that OpenAPI spec tag is set correctly"""
+        assert ThemeRestApi.openapi_spec_tag == "Themes"
+
+    def test_bulk_delete_enabled(self):
+        """Test that bulk delete is enabled"""
+        # The bulk_delete method should be available
+        assert hasattr(ThemeRestApi, "bulk_delete")
+        assert callable(ThemeRestApi.bulk_delete)
diff --git a/tests/unit_tests/themes/model_test.py b/tests/unit_tests/themes/model_test.py
new file mode 100644
index 0000000000..d05bec0f87
--- /dev/null
+++ b/tests/unit_tests/themes/model_test.py
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+from superset.models.core import Theme
+
+
+class TestThemeModel:
+    """Unit tests for Theme model"""
+
+    def test_theme_model_attributes(self):
+        """Test that Theme model has correct attributes"""
+        assert hasattr(Theme, "id")
+        assert hasattr(Theme, "theme_name")
+        assert hasattr(Theme, "json_data")
+        assert hasattr(Theme, "uuid")  # from UUIDMixin
+        assert hasattr(Theme, "created_by_fk")  # from AuditMixinNullable
+        assert hasattr(Theme, "changed_by_fk")  # from AuditMixinNullable
+        assert hasattr(Theme, "created_on")  # from AuditMixinNullable
+        assert hasattr(Theme, "changed_on")  # from AuditMixinNullable
+
+    def test_theme_model_tablename(self):
+        """Test that Theme model has correct table name"""
+        assert Theme.__tablename__ == "themes"
+
+    def test_theme_model_docstring(self):
+        """Test that Theme model has correct docstring"""
+        assert Theme.__doc__ == "Themes for dashboards"
+
+    def test_theme_model_inheritance(self):
+        """Test that Theme model inherits from correct mixins"""
+        from flask_appbuilder import Model
+
+        from superset.models.helpers import AuditMixinNullable, UUIDMixin
+
+        # Check that Theme inherits from the expected classes
+        assert issubclass(Theme, AuditMixinNullable)
+        assert issubclass(Theme, UUIDMixin)
+        assert issubclass(Theme, Model)