# How to label bibliography items, books and articles and others?

It is possible to segment bibliography by type (https://www.overleaf.com/learn/latex/Articles/Getting_started_with_BibLaTeX):

\printbibheading


And its also possible to segment by section like explored at Segmented bibliography with name of section.

The last one is more interesting thought additionally I would like to quickly see which ones are books and which ones are articles.

Is there some way to label the items as books or articles (or online, or other types)?

May be present things like:

[1] [book] Leslie Lamport, LaTeX: A Document Preparation System, ...
[2] [article] Joel Falcou, Designing HPC libraries in the modern C++ world,
...


Optionally will be nice to customize a little, perhaps:

[1]    BOOK Leslie Lamport, LaTeX: A Document Preparation System, ...
[2] ARTICLE Joel Falcou, Designing HPC libraries in the modern C++ world,
...


Or:

[1] BOOK Leslie Lamport, LaTeX: A Document Preparation System, ...

[2] ARTICLE Joel Falcou, Designing HPC libraries in the modern C++ world,

Will it be too much to ask for different colors for diff types, like articles in red, books in blue? Or automatic color selection.

biblatex saves the entry type of each entry in the entrytype field. It can be printed with \printfield{entrytype}. The output can be styled with \DeclareFieldFormat{entrytype}.

All standard styles and most good contributed style know the general-purpose bibmacro begentry that is executed at the beginning of each bibliography driver.

Putting this together you might want to try

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

\DeclareFieldFormat{entrytype}{\texttt{@#1}}

\begin{document}
\cite{sigfridsson,worman,nussbaum,geer,cicero}
\end{document}


If you want a fancy alignment you may have to measure the width of the strings. This can be done using some internal commands

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

\newlength{\entrytypewidth}
\makeatletter
\AtDataInput{%
\abx@flfw@getfieldformat{abx@flfw@entrytypewidth}{entrytypewidth}{entrytype}%
\blx@setlabwidth{\entrytypewidth}{%
\csuse{abx@flfw@entrytypewidth}{\abx@field@entrytype}}}
\makeatother

\DeclareFieldFormat{entrytypewidth}{\textbf{#1}}
\DeclareFieldFormat{entrytype}{\makebox[\the\entrytypewidth][r]{\textbf{#1}}}
\renewbibmacro*{begentry}{\printfield{entrytype}\printunit{\enskip}}