Skip to content

Instantly share code, notes, and snippets.

@simianhacker
Created September 1, 2025 22:08
Show Gist options
  • Select an option

  • Save simianhacker/4ebcff946638534e60a8cf8047771e7f to your computer and use it in GitHub Desktop.

Select an option

Save simianhacker/4ebcff946638534e60a8cf8047771e7f to your computer and use it in GitHub Desktop.
Gemini CLI session demonstrating how to find and use EUI theme variables.

Gemini CLI Session: EUI Theme Variable Investigation

This Gist documents a session with the Gemini CLI, demonstrating how it can be used to investigate and understand theme variables within the Elastic UI (EUI) framework.

Prompt 1: "What are the EUI theme varibles for the border color?"

1. Initial Search

To begin, I used a broad semantic search to find files related to EUI's theme and border colors.

Tool Used: semantic_code_search Query: EUI theme variables for border color

2. Response

The search results pointed directly to packages/eui-theme-common/src/global_styling/variables/colors.ts, which contained the _EuiThemeBorderColors TypeScript type definition. This provided a clear list of all available border color variables.

My Response:

Based on the search results, the core EUI theme variables for border colors are defined in packages/eui-theme-common/src/global_styling/variables/colors.ts.

Here are the available variables from the _EuiThemeBorderColors type:

export type _EuiThemeBorderColors = {
  borderBasePrimary: ColorModeSwitch;
  borderBaseAccent: ColorModeSwitch;
  borderBaseAccentSecondary: ColorModeSwitch;
  borderBaseNeutral: ColorModeSwitch;
  borderBaseSuccess: ColorModeSwitch;
  borderBaseWarning: ColorModeSwitch;
  borderBaseRisk: ColorModeSwitch;
  borderBaseDanger: ColorModeSwitch;

  borderBasePlain: ColorModeSwitch;
  borderBaseSubdued: ColorModeSwitch;
  borderBaseDisabled: ColorModeSwitch;
  /**
   * Border used for floating elements on dark mode (e.g. popovers or tooltips)
   * to increase the contrast with the background.
   */
  borderBaseFloating: ColorModeSwitch;

  borderBaseFormsColorSwatch: ColorModeSwitch;
  borderBaseFormsControl: ColorModeSwitch;

  borderInteractiveFormsHoverPlain: ColorModeSwitch;
  borderInteractiveFormsHoverDanger: ColorModeSwitch;

  borderStrongPrimary: ColorModeSwitch;
  borderStrongAccent: ColorModeSwitch;
  borderStrongAccentSecondary: ColorModeSwitch;
  borderStrongNeutral: ColorModeSwitch;
  borderStrongSuccess: ColorModeSwitch;
  borderStrongWarning: ColorModeSwitch;
  borderStrongRisk: ColorModeSwitch;
  borderStrongDanger: ColorModeSwitch;
  borderStrongText: ColorModeSwitch;
};

These variables are then assigned specific color values within different themes, such as the Borealis theme found in packages/eui-theme-borealis/src/variables/colors/_colors_light.ts and _colors_dark.ts.


Prompt 2: "What's the HEX code for the light borderBasePrimary?"

1. Tracing the Variable

The initial search showed that borderBasePrimary was defined in theme-specific files. I started by looking at the Borealis light theme implementation, which showed borderBasePrimary was set to SEMANTIC_COLORS.primary30.

Tool Used: read_file File Path: /Users/ccowan/Projects/eui/packages/eui-theme-borealis/src/variables/colors/_semantic_colors.ts

2. Drilling Down

The _semantic_colors.ts file revealed that primary30 was an alias for PRIMITIVE_COLORS.blue30. To find the final HEX code, I needed to read one more file.

Tool Used: read_file File Path: /Users/ccowan/Projects/eui/packages/eui-theme-borealis/src/variables/colors/_primitive_colors.ts

3. Final Answer

This file contained the direct mapping of blue30 to its HEX code.

My Response:

The HEX code for the light borderBasePrimary is #BFDBFF.

Here's the breakdown:

  1. borderBasePrimary is set to SEMANTIC_COLORS.primary30.
  2. SEMANTIC_COLORS.primary30 is set to PRIMITIVE_COLORS.blue30.
  3. PRIMITIVE_COLORS.blue30 is #BFDBFF.

Prompt 3: "Can you show me an example of using that in a react component?"

1. Generating the Example

Based on my knowledge of EUI and React, I created a functional component that demonstrates how to access theme colors using the useEuiTheme hook.

2. Response

My Response:

Of course. Here is an example of how to use the borderBasePrimary color in a React component using EUI's theming hooks.

import React from 'react';
import { useEuiTheme, EuiPanel } from '@elastic/eui';

export const BorderExample = () => {
  const { euiTheme } = useEuiTheme();

  const panelStyles = {
    // Access the color directly from the theme object
    borderColor: euiTheme.colors.borderBasePrimary,
    borderWidth: '2px',
    borderStyle: 'solid',
  };

  return (
    <EuiPanel style={panelStyles} paddingSize="l">
      This panel uses the 'borderBasePrimary' color for its border.
    </EuiPanel>
  );
};

How it works:

  1. import { useEuiTheme } from '@elastic/eui';: We import the necessary hook from EUI.
  2. const { euiTheme } = useEuiTheme();: Inside the component, we call the hook to get access to the current theme's variables.
  3. borderColor: euiTheme.colors.borderBasePrimary: We create a style object and set the borderColor property by accessing euiTheme.colors.borderBasePrimary. EUI automatically provides the correct HEX code based on whether the light or dark theme is active.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment