afrantzis / bless

Bless - Gtk# Hex Editor
GNU General Public License v2.0
216 stars 38 forks source link

Alternate row coloring #37

Closed Hordeking closed 4 years ago

Hordeking commented 4 years ago

I was playing around with the latest codebase (Mint Repos are way behind for some reason, even with that critical bug where it can't save a file being edited), and I noticed that there's no way to set a layout to have alternating row colors. For instance, the default layouts have the columns with alternating foregrounds and white backgrounds, which is fine. However, I would love to be able to also specify foreground and background colors for even and odd rows.

This could be implemented in such a way that colors for columns override this if specified (which would mean that the default would be to leave off the background tags for columns).

The effect would be a bit like the old-style alternating row color spreadsheets. If I get around to implementing this, I may issue a pull request.

afrantzis commented 4 years ago

Hi! Unless I am misunderstanding your requirements, this is already supported. You can find more info about creating a custom layout in the manual (press F1 or go to Help » Contents) in the Customizing Bless » Layout Files section.

For example, the following layout:

<layout>
    <area type="hexadecimal">
        <display>
            <evenrow>
                <evencolumn>
                    <foreground>dark red</foreground>
                    <background>white</background>
                </evencolumn>
                <oddcolumn>
                    <foreground>dark green</foreground>
                    <background>dark gray</background>
                </oddcolumn>
            </evenrow>
            <oddrow>
                <evencolumn>
                    <foreground>light blue</foreground>
                    <background>black</background>
                </evencolumn>
                <oddcolumn>
                    <foreground>yellow</foreground>
                    <background>dark gray</background>
                </oddcolumn>
            </oddrow>
        </display>
        <case>upper</case>
    </area>
</layout>

produces:

Hordeking commented 4 years ago

While it works, it's sort of a kludgy way of doing it. I was hoping for something more like:

<display>
    <evenrow>
        <background>white</background>`
        <evencolumn>
            <stuff>...</stuff>
        </evencolumn>
        <oddcolumn>
            <stuff>...</stuff>
        </oddcolumn>
    </evenrow>
    <oddrow>
        <background>light gray</background>
        <evencolumn>
            <stuff>...</stuff>
        </evencolumn>
        <oddcolumn>
            <stuff>...</stuff>
        </oddcolumn>
    </oddrow>
</display>

Yielding:

image

Your solution seems to be working fine, and so I can probably live with it, but maybe something to consider in the future. Or maybe it's just something to address in the documents as something one can do?