% -*- coding: utf-8 -*-
% !TEX program = xelatex

\documentclass[14pt]{beamer}

\usepackage{coloring}
\usetheme[color=green]{epyt} % https://www.ctan.org/pkg/epyt

\usepackage{arev} % use arev sans font

\hypersetup{
  pdfpagemode={FullScreen},
}

\usepackage{listings}
\lstset{basicstyle=\ttfamily\color{rgbx55}}

\usepackage{tabu}

\AtBeginDocument{
  \setlength{\parskip}{5pt plus 1pt minus 1pt}
  \setlength{\baselineskip}{19pt plus 1pt minus 1pt}
  \setlength{\lineskiplimit}{4pt}
  \setlength{\lineskip}{4pt}
}

\begin{document}

\title{LaTeX Package Coloring}
\author{zohooo@yeah.net}
%\institute{https://github.com/zohooo/coloring}

\begin{frame}%[plain]
\transboxout
\titlepage
\end{frame}

\begin{frame}[fragile]{Introduction}
The \verb|coloring| package makes it possible to define colors automatically by their names.
\begin{itemize}
  \item It's useful in drawing a \verb|tikz| picture.
  \item It's useful in designing a \verb|beamer| theme.
\end{itemize}
Using the package, you \alert{don't} need to write \verb|\definecolor| before using a color.
\end{frame}

\begin{frame}[fragile]{Example One: Gray Colors}
When you write
\begin{lstlisting}
\textcolor{gray2}{Text}
\end{lstlisting}
The package will automatically define the following \alert{gray} color for you
\begin{lstlisting}
\definecolor{gray2}{gray}{0.2}
\end{lstlisting}
\end{frame}

\begin{frame}[fragile]{Example Two: RGB Colors}
When you write
\begin{lstlisting}
\colorbox{rgb37x}{Text}
\end{lstlisting}
The package will automatically define the following \alert{rgb} color for you
\begin{lstlisting}
\definecolor{rgb37x}{rgb}{0.3,0.7,1.0}
\end{lstlisting}
\end{frame}

\begin{frame}[fragile]{Example Three: HSB Colors}
When you write
\begin{lstlisting}
\colorlet{mycolor}{blue59}
\end{lstlisting}
The package will automatically define the following \alert{hsb} color for you
\begin{lstlisting}
\definecolor{blue59}{Hsb}{240,0.5,0.9}
\end{lstlisting}
You may add the following line to the preamble when using hsb colors
\begin{lstlisting}
\substitutecolormodel{hsb}{rgb}
\end{lstlisting}
\end{frame}

\def\mycolor#1{\noindent\color{black}\fcolorbox{gray}{#199}{\strut#1}}
\begin{frame}{HSB Colors}
\begin{center}
\begin{tabu}{|r|X||r|X|}\hline
  Hue & Name             & Hue & Name              \\\hline
  0   & \mycolor{red}    & 180 & \mycolor{cyan}    \\\hline
  30  & \mycolor{brown}  & 210 & \mycolor{azure}   \\\hline
  60  & \mycolor{yellow} & 240 & \mycolor{blue}    \\\hline
  90  & \mycolor{olive}  & 270 & \mycolor{violet}  \\\hline
  120 & \mycolor{green}  & 300 & \mycolor{magenta} \\\hline
  150 & \mycolor{teal}   & 330 & \mycolor{purple}  \\\hline
\end{tabu}
\end{center}
\end{frame}

\end{document}
