How to pull hex-values from an autocad color book “acb” file

The “.acb” file is actually an xml file. If you open the .acb file inside a text editor, you’ll see something like this:

<?xml version="1.0" encoding="UTF-8"?>
  <bookName>Eiffel Tower Screen-Shot-2021-03-10-at-8.25.35-AM copy</bookName> 

You’ll see the color values are stored in RGB format. We want them in hex.

Steps to convert acb to hexvalues

1. Convert your acb file to a tab-delimited file

1a. Create an xls file to convert your xml to a tab-delimited file.

Copy the following text into a text document, and name it with an .xsl ending. I used “xsl-pull_rgb_color.xsl”

<xsl:stylesheet version="2.0" 
<xsl:template match="/">
       <xsl:for-each select="colorBook/colorPage/colorEntry/RGB8">
               <xsl:value-of select="red"/><xsl:text>&#009;</xsl:text>
               <xsl:value-of select="green"/><xsl:text>&#009;</xsl:text>
               <xsl:value-of select="blue"/>

1b. Open the .acb file in Xmplify.

1c. Go to Transform > Current Document, Using An XSL File as Template…

1d. Select the xsl file we just made: “xsl-pull_rgb_color.xsl”

1e. It will convert your acb file to this:

245 244 250
236 235 237
221 221 224
209 208 210
137 138 145

2. Copy the tab-delimited file into Google Sheets

Copy that text and paste it into a Google spreadsheet.

First column, red. Second column, blue. Third column, green.

3. Have Google Sheets make the conversion

Fourth column will be a formula: =dec2hex(A2)&dec2hex(B2)&dec2hex(C2)
The dec2hex function suggestion came from Craig Cornelius, Senior Software Engineer at Google

Boom. Now you have your hexvalues!

It’s a little clumsy. Maybe some day I’ll write something in PHP that simply converts the acb file to hex values in one step.

Enjoyed this blog post?

Join the creatives who receive thoughtful Spudart blog posts via the email newsletter


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x