Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Steema/TeeChart-VCL-GitHub-Contributions/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This page documents all public functions, procedures, and types used in the GitHub Contributions Chart application. All code references include file locations for easy navigation.Functions
DownloadWeb
Downloads content from a URL using HTTP GET request. Location:Unit1.pas:55-64
The URL to download from. Must be a valid HTTP or HTTPS URL.
string - The response body as a string
Description:
Creates a temporary TNetHTTPClient instance, performs a GET request to the specified URL, and returns the response content as a string. The HTTP client is automatically freed after the request completes.
Implementation:
GetGitHubContributions
Fetches GitHub contribution data for a specific user from the github-contributions API. Location:Unit1.pas:66-72
The GitHub username to fetch contributions for. Case-sensitive.
TJSONObject - A JSON object containing contribution data with the following structure:
TJSONObject for easy traversal.
Implementation:
The caller is responsible for freeing the returned
TJSONObject to prevent memory leaks.FormatMark
Formats a date into a human-readable string with ordinal suffix (e.g., “March 4th”). Location:Unit1.pas:109-120
The date to format. Must be a valid TDateTime value.
string - Formatted date string with ordinal suffix
Description:
Converts a date into a readable format like “January 1st”, “February 2nd”, “March 3rd”, or “April 4th”. Uses invariant format settings to ensure consistent English month names.
Implementation:
FormatMark(EncodeDate(2024, 3, 1))→ “March 1st”FormatMark(EncodeDate(2024, 3, 2))→ “March 2nd”FormatMark(EncodeDate(2024, 3, 3))→ “March 3rd”FormatMark(EncodeDate(2024, 3, 4))→ “March 4th”FormatMark(EncodeDate(2024, 3, 21))→ “March 21st”
This function is used to generate tooltip text for each contribution square in the chart.
IntensityThemeColor
Maps a GitHub intensity level (0-4) to the corresponding color in the current theme. Location:Unit1.pas:175-178
The contribution intensity level. Valid range: 0-4
- 0: No contributions
- 1: Low contributions
- 2: Medium contributions
- 3: High contributions
- 4: Very high contributions
TColor - The color corresponding to the intensity level in the active theme
Description:
Looks up the color for a given intensity level from the currentTheme.Grades array. This function provides the color mapping that makes the contribution graph visually represent activity levels.
Implementation:
- Intensity 0:
$F0EDEB(Very light gray) - Intensity 1:
$A8E99B(Light green) - Intensity 2:
$63C440(Medium green) - Intensity 3:
$4EA130(Dark green) - Intensity 4:
$396E21(Very dark green)
Procedures
CustomWeekDayOfTheYear
Calculates the week number and day of week for a given date, with support for different week start days. Location:Unit1.pas:122-143
The date to calculate week and day for.
Specifies which day starts the week:
0: Sunday as first day of week1: Monday as first day of week
Output parameter. Receives the week number of the year (1-53).Special values:
-1: Date belongs to previous year’s last weekWeeksInYear + 1: Date belongs to next year’s first week
Output parameter. Receives the day of the week (1-7).When
AFirstDayOfWeek = 0 (Sunday start):- 1 = Sunday, 2 = Monday, …, 7 = Saturday
AFirstDayOfWeek = 1 (Monday start):- 1 = Monday, 2 = Tuesday, …, 7 = Sunday
This function is critical for positioning contribution squares correctly in the chart grid.
Types
TTheme
Defines a complete color scheme for the application. Location:Themes.pas:8-13
The background color for the form and controls.
The primary text color for labels and annotations.
The secondary text color for metadata (currently unused).
An array of 5 colors representing contribution intensity levels:
Grades[0]: No contributions (lightest)Grades[1]: Low contributionsGrades[2]: Medium contributionsGrades[3]: High contributionsGrades[4]: Very high contributions (darkest/most saturated)
Grades array provides the five-level color scale used to visualize GitHub contribution intensity.
Constants
StandardTheme
The default light theme matching GitHub’s standard color scheme. Location:Themes.pas:16-21
Background
$FFFFFF - Pure whiteText
$000000 - Pure blackMeta
$666666 - Medium grayGrade 0
$F0EDEB - Very light beige (no activity)Grade 1
$A8E99B - Light greenGrade 2
$63C440 - Medium greenGrade 3
$4EA130 - Dark greenGrade 4
$396E21 - Very dark greenDelphi uses BGR color format, so
$RRGGBB in CSS becomes $BBGGRR in Pascal.GithubDarkTheme
The dark theme matching GitHub’s dark mode color scheme. Location:Themes.pas:23-28
Background
$101217 - Very dark gray (near black)Text
$FFFFFF - Pure whiteMeta
$DDDDDD - Light grayGrade 0
$221B16 - Dark brown (no activity)Grade 1
$203800 - Very dark greenGrade 2
$2D6000 - Dark greenGrade 3
$3D9810 - Medium bright greenGrade 4
$45D527 - Bright lime greenModule-Level Variables
These variables maintain global state for the application. Location:Unit1.pas:49-53
gitHubContributions
Stores the complete JSON response from the GitHub contributions API. Contains both the
years array and the contributions array. This object persists across chart redraws to avoid re-fetching data.monthTitles
Array of 12 annotation tools, one for each month label (Jan, Feb, Mar, etc.). Created in
FormCreate and positioned in DrawChart.dayTitles
Array of 3 annotation tools for alternating weekday labels (Mon, Wed, Fri or Sun, Tue, Thu depending on week start). Created in
FormCreate and positioned in DrawChart.currentTheme
The currently active theme. Initialized to
StandardTheme in the unit’s initialization section. Modified by the theme toggle button.Usage Examples
Fetching and Displaying Contributions
Custom Theme Creation
Date Formatting
See Also
Code Structure
Learn how these APIs are used in the application architecture
Development Setup
Set up your environment to use these APIs
