diff --git a/packages/grafana-ui/src/themes/ThemeContext.tsx b/packages/grafana-ui/src/themes/ThemeContext.tsx
index 1087f23b76c..1e0ef779ff8 100644
--- a/packages/grafana-ui/src/themes/ThemeContext.tsx
+++ b/packages/grafana-ui/src/themes/ThemeContext.tsx
@@ -22,6 +22,7 @@ export const ThemeContext = React.createContext(createTheme());
ThemeContext.displayName = 'ThemeContext';
/** @deprecated use withTheme2 */
+/** @public */
export const withTheme =
(Component: React.ComponentType
) => {
const WithTheme: React.FunctionComponent> = (props) => {
/**
@@ -62,10 +63,12 @@ export const withTheme2 = (Component: R
};
/** @deprecated use useTheme2 */
+/** @public */
export function useTheme(): GrafanaTheme {
return useContext(ThemeContextMock || ThemeContext).v1;
}
+/** @public */
export function useTheme2(): GrafanaTheme2 {
return useContext(ThemeContextMock || ThemeContext);
}
@@ -77,6 +80,7 @@ export function useTheme2(): GrafanaTheme2 {
* you pass in doesn't change, or only if it needs to. (i.e. declare
* your style creator outside of a function component or use `useCallback()`.)
* */
+/** @public */
export function useStyles(getStyles: (theme: GrafanaTheme) => T) {
const theme = useTheme();
@@ -96,6 +100,7 @@ export function useStyles(getStyles: (theme: GrafanaTheme) => T) {
* you pass in doesn't change, or only if it needs to. (i.e. declare
* your style creator outside of a function component or use `useCallback()`.)
* */
+/** @public */
export function useStyles2(getStyles: (theme: GrafanaTheme2) => T) {
const theme = useTheme2();
@@ -111,6 +116,7 @@ export function useStyles2(getStyles: (theme: GrafanaTheme2) => T) {
/**
* Enables theme context mocking
*/
+/** @public */
export const mockThemeContext = (theme: Partial) => {
ThemeContextMock = React.createContext(theme as GrafanaTheme2);
diff --git a/packages/grafana-ui/src/themes/getTheme.ts b/packages/grafana-ui/src/themes/getTheme.ts
index 66d4f708da3..03fc83a4c7e 100644
--- a/packages/grafana-ui/src/themes/getTheme.ts
+++ b/packages/grafana-ui/src/themes/getTheme.ts
@@ -2,6 +2,7 @@ import { createTheme, GrafanaTheme } from '@grafana/data';
let themeMock: ((name?: string) => GrafanaTheme) | null;
+/** @public */
export const getTheme = (mode: 'dark' | 'light' = 'dark') => {
if (themeMock) {
return themeMock(mode);
@@ -10,6 +11,7 @@ export const getTheme = (mode: 'dark' | 'light' = 'dark') => {
return createTheme({ colors: { mode } }).v1;
};
+/** @public */
export const mockTheme = (mock: (name?: string) => GrafanaTheme) => {
themeMock = mock;
return () => {