# COLORLIB file

{% hint style="info" %}
This file format is used by the second iteration of the [Color converter and library](/home/vbnetframework/color-library-and-converter.md), which is still maintained.
{% endhint %}

The .colorlib file is a special binary file format designed for the color library specifically.

## File specification

### Extension

* `.colorlib`

### Byte order

* Little-endian

### Data types

* `string`: length prefixed string in UTF-8 encoding, the prefix contains the encoded length as a 7-bit encoded unsigned integer
* `byte`: 8-bit unsigned integer
* `uint16`: 16-bit unsigned integer
* `uint32`: 32-bit unsigned integer
* `single`: 32-bit floating point number

### Structure

```c
// overall file
ColorLibrary {
	string			header signature			// always "MRC color library"
	uint16			file version
	string			LibraryName
	uint16			padding						// always 0
	
	uint16			nCategories
	ColorCategory	Categories[nCategories]
	
	uint32			EOF signature				// always 0
}

// category
ColorCategory {
	string			CategoryName
	uint16			nColors
	ColorItem		Colors[nColors]
}

// color
ColorItem {
	string			ColorName
	byte			Format						// 0: sRGB 8-bit, 1: sRGB, 2: linear RGB
	byte/single		Red							// byte for Format = 0, single otherwise
	byte/single		Green						// byte for Format = 0, single otherwise
	byte/single		Blue						// byte for Format = 0, single otherwise
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mrcmodding.gitbook.io/home/vbnetframework/color-library-and-converter/colorlib-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
