% !TEX encoding = UTF-8 Unicode
%% Copyright 2023-2025 Clea F. Rees
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008-05-04 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Clea F. Rees.
%%
%% This file may only be distributed together with a copy of the package
%% chronos. You may however distribute the package chronos without
%% such generated files.
%%
%% This work consists of all files listed in manifest.txt.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[2021-11-15]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% copied verbatim, excepting format from Joseph Wright's' siunitx.sty under LPPL
\@ifundefined{ExplLoaderFileDate}{%
  \RequirePackage{expl3}%
}{}
% almost verbatim from siunitx.sty
\@ifl@t@r\ExplLoaderFileDate{2022-02-24}{%
}{%
  \PackageError{chronos}{Support package expl3 too old}
  {%
    You need to update your installation of the bundles 'l3kernel' and
    'l3packages'.\MessageBreak
    Loading~chronos~will~abort!%
  }%
  \endinput
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{svn-prov}
\ProvidesPackageSVN{$Id: chronos.sty 10885 2025-02-28 21:34:09Z cfrees $}[v0.9 \revinfo]
\ExplSyntaxOn
\newif\ifchronos@enwaulliwsyml
\keys_define:nn { chronos }
% \DeclareKeys [ chronos ]
{
  enwau~lliw~syml .legacy_if_set:n = chronos@enwaulliwsyml,
  enwau~lliw~syml .default:n = true,
  enwau~lliw~syml .initial:n = true,
  enwau~lliw~syml .usage:n = general,
  simple~colour~names .legacy_if_set:n = chronos@enwaulliwsyml,
  simple~colour~names .default:n = true,
  simple~colour~names .usage:n = general,
  simple~color~names .legacy_if_set:n = chronos@enwaulliwsyml,
  simple~color~names .default:n = true,
  simple~color~names .usage:n = general,
  dim~enwau~lliw~syml .legacy_if_set_inverse:n = chronos@enwaulliwsyml,
  dim~enwau~lliw~syml .default:n = true,
  dim~enwau~lliw~syml .usage:n = general,
  no~simple~colour~names .legacy_if_set_inverse:n = chronos@enwaulliwsyml,
  no~simple~colour~names .default:n = true,
  no~simple~colour~names .usage:n = general,
  no~simple~color~names .legacy_if_set_inverse:n = chronos@enwaulliwsyml,
  no~simple~color~names .default:n = true,
  no~simple~color~names .usage:n = general,
}
% Joseph Wright: from siunitx.sty ; https://chat.stackexchange.com/transcript/message/64327823#64327823
\providecommand \IfFormatAtLeastTF { \@ifl@t@r \fmtversion }
\IfFormatAtLeastTF { 2022-06-01 }
{
  \ProcessKeyOptions [ chronos ] 
}{
  \RequirePackage { l3keys2e }
  \ProcessKeysOptions { chronos }
}
\IfFormatAtLeastTF { 2020-10-01 }{
}{
  \RequirePackage { xparse }
  \providecommand \ExpandArgs [1]
  { \cs_if_exist_use:c { exp_args:N #1 } }
}
% \ProcessKeyOptions [chronos]
\ExplSyntaxOff
\RequirePackage{xcolor}
% mae fixedpointarithmetic eisiau fp
\RequirePackage{tikz,etoolbox,pgfcalendar,calc,fp}% rwyt ti *eisiau* calc!
\usetikzlibrary{arrows.meta,calc,positioning,fixedpointarithmetic,decorations.text,fit,shadows}
\IfFileExists{tikzlibrarycfrforeground.code.tex}{%
  \usetikzlibrary{cfrforeground}%
}{%
  \usetikzlibrary{backgrounds}%
}
% BEGIN expl3
\ExplSyntaxOn
% BEGIN booleans
\bool_new:N \l__chronos_byw_troi_bool
\bool_new:N \l__chronos_digwyddiad_troi_bool
\bool_new:N \l__chronos_parhad_troi_bool
\bool_new:N \l__chronos_theori_troi_bool
\bool_new:N \l__chronos_gwybodaeth_troi_bool
\bool_new:N \l__chronos_troi_bool
% END booleans
% BEGIN clists
\clist_new:N \g__chronos_lliwiau_uchod_clist
\clist_new:N \g__chronos_lliwiau_isod_clist
\clist_new:N \g__chronos_lliwiau_byw_uchod_clist
\clist_new:N \g__chronos_lliwiau_byw_isod_clist
\clist_new:N \g__chronos_lliwiau_parhad_uchod_clist
\clist_new:N \g__chronos_lliwiau_parhad_isod_clist
\clist_new:N \g__chronos_lliwiau_digwyddiad_uchod_clist
\clist_new:N \g__chronos_lliwiau_digwyddiad_isod_clist
\clist_new:N \g__chronos_lliwiau_theori_uchod_clist
\clist_new:N \g__chronos_lliwiau_theori_isod_clist
\clist_new:N \g__chronos_lliwiau_uchod_rhag_clist
\clist_new:N \g__chronos_lliwiau_isod_rhag_clist
\clist_new:N \g__chronos_lliwiau_byw_uchod_rhag_clist
\clist_new:N \g__chronos_lliwiau_byw_isod_rhag_clist
\clist_new:N \g__chronos_lliwiau_parhad_uchod_rhag_clist
\clist_new:N \g__chronos_lliwiau_parhad_isod_rhag_clist
\clist_new:N \g__chronos_lliwiau_digwyddiad_uchod_rhag_clist
\clist_new:N \g__chronos_lliwiau_digwyddiad_isod_rhag_clist
\clist_new:N \g__chronos_lliwiau_theori_uchod_rhag_clist
\clist_new:N \g__chronos_lliwiau_theori_isod_rhag_clist
\clist_new:N \l__chronos_llythrennau_bach_clist
\clist_set:Nn \l__chronos_llythrennau_bach_clist { a, an, and, as, but, for, if, in, is, of, on, the }
\clist_new:N \l__chronos_dyddiadau_coords_clist
\clist_new:N \l__chronos_subheadings_clist
\clist_new:N \g__chronos_century_subheadings_clist
\clist_new:N \l__chronos_headings_clist
\clist_new:N \l__chronos_tmpa_clist
\clist_new:N \g__chronos_tmpa_clist
\clist_new:N \l__chronos_tmpb_clist
\clist_new:N \l__chronos_tmpc_clist
% END clists
% BEGIN integers
\int_gzero_new:N \g__chronos_int
\int_new:N \l__chronos_tmpa_int
\int_new:N \l__chronos_tmpb_int
% END integers
% BEGIN prop
\prop_new:N \l__chronos_byw_prop
\prop_new:N \l__chronos_digwyddiad_prop
\prop_new:N \l__chronos_gwybodaeth_prop
\prop_new:N \l__chronos_parhad_prop
\prop_new:N \l__chronos_theori_prop
% \prop_new:N \l__chronos_cylchtheori_prop
\prop_new:N \l__chronos_rhagosedig_prop
\prop_new:N \l__chronos_prop
\prop_new:N \l__chronos_tmpa_prop
% END prop
% BEGIN regexes
\regex_const:Nn \c__chronos_enw_regex { [^A-Za-z0-9\s\-] }
\regex_const:Nn \c__chronos_enw_priflythren_cyntaf_regex { (^[^A-Za-z]*)([a-z]) }
\regex_const:Nn \c__chronos_enw_diogelu_regex { ([\s\-\c{\\}][[:punct:]]*) ([^\s\-\c{\\}]*) (\b|\c{\\}) } % \s unrhyw space character \b word boundary
% \regex_const:Nn \c__chronos_pure_year_regex { ^ [\+\-]? \d+ \z }% \z = \Z = $ ($ yn newid popeth i maths yn ôl Kile!)
\regex_const:Nn \c__chronos_curly_bracket { [ \{ \} ] }
\regex_const:Nn \c__chronos_initial_minus { ^\- }
% END regexes
% BEGIN seq
\seq_new:N \l__chronos_gosod_seq
\seq_new:N \l__chronos_tmpa_seq
% END seq
% BEGIN token lists
\tl_new:N \l__chronos_lliw_tl
\tl_new:N \l__chronos_date_tl
\tl_new:N \l__chronos_dateformat_tl
\tl_new:N \l__chronos_year_tl
\tl_new:N \l__chronos_yearformat_tl
\tl_new:N \l__chronos_minoryearformat_tl
\tl_new:N \l__chronos_tikzname_tl
\tl_set:Nn \l__chronos_dateformat_tl { !d/!m/!Y }
\tl_set:Nn \l__chronos_yearformat_tl { !Y }
\tl_set:Nn \l__chronos_minoryearformat_tl { !c }
\tl_new:N \l__chronos_tmpa_tl
\tl_new:N \l__chronos_tmpb_tl
\tl_new:N \l__chronos_tmpc_tl
\tl_new:N \l__chronos_tmpd_tl
% END token lists
% BEGIN l3 keys
\keys_define:nn { chronos / lliwiau }
{
  foreground .code:n = {\__chronos_color_set_from_existing:nn {chronos@prifliw}{#1}},
  foreground .groups:n = {core},
  background .code:n = {\__chronos_color_set_from_existing:nn {chronos@prifliw@cefndir}{#1}},
  background .groups:n = {core},
  timeline ~ foreground .code:n = {\__chronos_color_set_from_existing:nn {chronos@lliw@llinell}{#1} 
  },
  timeline ~ foreground .groups:n = {core ~ derivative},
  timeline ~ background .code:n = {\__chronos_color_set_from_existing:nn {chronos@lliw@cefndir@llinell}{#1}},
  timeline ~ background .groups:n = {core ~ derivative},
  timeline ~ border ~ outer  .code:n = {\__chronos_color_set_from_existing:nn {chronos@borderouter}{#1}},
  timeline ~ border ~ outer .groups:n = {core ~ border},
  timeline ~ border ~ inner  .code:n = {\__chronos_color_set_from_existing:nn {chronos@borderinner}{#1}},
  timeline ~ border ~ inner .groups:n = {core ~ border},
  timeline ~ border ~ middle  .code:n = {\__chronos_color_set_from_existing:nn {chronos@bordermiddle}{#1}},
  timeline ~ border ~ middle .groups:n = {core ~ border},
  life / default .code:n = {\__chronos_color_set_from_existing:nn {chronos@byw@lliw@rhagosodedig}{#1}},
  event / default .code:n = {\__chronos_color_set_from_existing:nn {chronos@digwyddiad@lliw@rhagosodedig}{#1}},
  period / default .code:n = {\__chronos_color_set_from_existing:nn {chronos@parhad@lliw@rhagosodedig}{#1}},
  theory / default .code:n = {\__chronos_color_set_from_existing:nn {chronos@theori@lliw@rhagosodedig}{#1}},
  info / default .code:n = {\__chronos_color_set_from_existing:nn {chronos@gwybodaeth@lliw@rhagosodedig}{#1}},
  default ~ above .clist_gset:N = \g__chronos_lliwiau_uchod_clist,
  default ~ below .clist_gset:N = \g__chronos_lliwiau_isod_clist,
  life /  above .clist_gset:N = \g__chronos_lliwiau_byw_uchod_clist,
  life / below .clist_gset:N = \g__chronos_lliwiau_byw_isod_clist,
  event / above .clist_gset:N = \g__chronos_lliwiau_digwyddiad_uchod_clist,
  event / below .clist_gset:N = \g__chronos_lliwiau_digwyddiad_isod_clist,
  period / above .clist_gset:N = \g__chronos_lliwiau_parhad_uchod_clist,
  period / below .clist_gset:N = \g__chronos_lliwiau_parhad_isod_clist,
  theory / above .clist_gset:N = \g__chronos_lliwiau_theori_uchod_clist,
  theory / below .clist_gset:N = \g__chronos_lliwiau_theori_isod_clist,
}
% END l3 keys
% BEGIN functions
% BEGIN functions : dyddiadau
% YY yn lle YYYY
\cs_new_protected_nopar:Npn \__chronos_year_shorten:n #1
{
  \int_set:Nn \l__chronos_tmpa_int { \tl_count:n { #1 } }
  \int_compare:nTF
  {
    \l__chronos_tmpa_int < 3
  }
  {
    #1
  }
  {
    \int_compare:nTF
    {
      \l__chronos_tmpa_int < 4
    }
    {
      \__chronos_year_shorten_aux:w 0 #1 \q_stop
    }
    {
      \__chronos_year_shorten_aux:w #1 \q_stop % expl3 manuaal, 46
    }
  }
}
\cs_new_protected_nopar:Npn \__chronos_year_shorten_aux:w #1 #2 #3 #4 \q_stop
{
  #3 #4
}
\cs_generate_variant:Nn \__chronos_year_shorten:n { V , v , x }
\cs_new_protected_nopar:Npn \__chronos_year_semi_shorten:n #1
{
%   \int_set:Nn \l__chronos_tmpb_int { \int_abs:n {#1} }
%   \tl_set:Nx \l__chronos_tmpc_tl { \int_to_arabic:n { \l__chronos_tmpb_int } }
  \int_set:Nn \l__chronos_tmpa_int { \tl_count:n { #1 } }
  \int_compare:nTF
  {
    \l__chronos_tmpa_int < 4
  }
  {
    #1
  }
  {
    \__chronos_year_semi_shorten_aux:w #1 \q_stop % expl3 manual, 46 (w/q_stop?) ; \S\,5.7 Unbraced     
%     \exp_last_unbraced:NV \__chronos_year_semi_shorten_aux:w \l__chronos_tmpc_tl \q_stop % expl3 manual, 46 (w/q_stop?) ; \S\,5.7 Unbraced Expansion: osgoi \exp_after:wN ble sy'n bosibl (\exp_args:N* yn well 'na \exp_last_unbraced:N*? wn i ddim sut i ddefnyddio hynny beth bynnag)
%     \exp_after:wN \__chronos_year_semi_shorten_aux:w \l__chronos_tmpc_tl \q_stop % expl3 manuaal, 46
  }
}
\cs_new_protected_nopar:Npn \__chronos_year_semi_shorten_aux:w #1 #2 #3 #4 \q_stop
{
  #2 #3 #4
}
\cs_generate_variant:Nn \__chronos_year_semi_shorten:n { V , v , x }
\cs_generate_variant:Nn \int_abs:n { v }
\cs_generate_variant:Nn \tl_replace_all:Nnn { Nnx }
% dangos dyddiadau
\cs_new_protected_nopar:Npn \__chronos_show_date:n #1
{% ateb Joseph Wright: http://tex.stackexchange.com/a/327642/ ; PD/CCO at https://tex.stackexchange.com/users/73/joseph-wright
  \tl_set_eq:NN \l__chronos_date_tl \l__chronos_dateformat_tl
  \tl_replace_all:Nnx \l__chronos_date_tl { !a } { \pgfcalendarweekdayshortname{\thechronos@weekday} }
  \tl_replace_all:Nnx \l__chronos_date_tl { !A } { \pgfcalendarweekdayname{\thechronos@weekday} }
  \tl_replace_all:Nnx \l__chronos_date_tl { !b } { \pgfcalendarmonthshortname{\csname chronos@#1month\endcsname} }
  \tl_replace_all:Nnx \l__chronos_date_tl { !B } { \pgfcalendarmonthname{\csname chronos@#1month\endcsname} }
  \tl_replace_all:Nnx \l__chronos_date_tl { !c } { \__chronos_year_semi_shorten:x { \int_abs:v { chronos@#1year } } }
  \tl_replace_all:Nnx \l__chronos_date_tl { !d } { \csname chronos@#1day\endcsname }
  \tl_replace_all:Nnx \l__chronos_date_tl { !E } { \__chronos_dateformat_era:v { chronos@#1year } }
  \tl_replace_all:Nnx \l__chronos_date_tl { !m } { \csname chronos@#1month\endcsname }
  \tl_replace_all:Nnx \l__chronos_date_tl { !q } { \__chronos_dateformat_sign:v { chronos@#1year } }
  \tl_replace_all:Nnx \l__chronos_date_tl { !Q } { \__chronos_dateformat_signs:v { chronos@#1year } }
  \tl_replace_all:Nnx \l__chronos_date_tl { !y } { \__chronos_year_shorten:x { \int_abs:v { chronos@#1year } } }
  \tl_replace_all:Nnx \l__chronos_date_tl { !Y } { \int_abs:v { chronos@#1year } }
  \l__chronos_date_tl
}
\cs_new_protected_nopar:Npn \__chronos_show_year:n #1
{% ateb Joseph Wright: http://tex.stackexchange.com/a/327642/ ; PD/CCO at https://tex.stackexchange.com/users/73/joseph-wright
  \tl_set_eq:NN \l__chronos_year_tl \l__chronos_yearformat_tl
  \tl_replace_all:Nnx \l__chronos_year_tl { !c } { \__chronos_year_semi_shorten:x { \int_abs:n { #1 } } }
  \tl_replace_all:Nnx \l__chronos_year_tl { !E } { \__chronos_dateformat_era:n { #1 } }
  \tl_replace_all:Nnx \l__chronos_year_tl { !q } { \__chronos_dateformat_sign:n { #1 } }
  \tl_replace_all:Nnx \l__chronos_year_tl { !Q } { \__chronos_dateformat_signs:n { #1 } }
  \tl_replace_all:Nnx \l__chronos_year_tl { !y } { \__chronos_year_shorten:x { \int_abs:n { #1 } } }
  \tl_replace_all:Nnx \l__chronos_year_tl { !Y } { \int_abs:n { #1 } }
  \l__chronos_year_tl
}
\cs_new_protected_nopar:Npn \__chronos_dateformat_sign:n #1
{
  \int_compare:nT { #1 < 0 } { - }
}
\cs_generate_variant:Nn \__chronos_dateformat_sign:n { v }
\cs_new_protected_nopar:Npn \__chronos_dateformat_signs:n #1
{
  \int_compare:nTF
  { #1 < 0 } { - }
  {
    \int_compare:nT { #1 > 0 }
    {
      +
    }
  }
}
\cs_generate_variant:Nn \__chronos_dateformat_signs:n { v }
\cs_new_protected_nopar:Npn \__chronos_dateformat_era:n #1
{
  \int_compare:nTF
  { #1 < 0 } { \chronos@yearbce }
  {
    \int_compare:nT { #1 > 0 }
    {
      \chronos@yearce
    }
  }
}
\cs_generate_variant:Nn \__chronos_dateformat_era:n { v }
\cs_new_protected_nopar:Npn \__chronos_set_dateformat:n #1
{
  \tl_set:Nn \l__chronos_dateformat_tl { #1 }
  \tl_replace_all:Nnn \l__chronos_dateformat_tl { ~ } { \c_space_token }
}
\cs_generate_variant:Nn \__chronos_set_dateformat:n { v }
\cs_new_protected_nopar:Npn \__chronos_set_yearformat:n #1
{
  \tl_set:Nn \l__chronos_yearformat_tl { #1 }
  \tl_replace_all:Nnn \l__chronos_yearformat_tl { ~ } { \c_space_token }
}
\cs_generate_variant:Nn \__chronos_set_yearformat:n { V }
\cs_new_protected_nopar:Npn \__chronos_set_minoryearformat:n #1
{
  \tl_set:Nn \l__chronos_minoryearformat_tl { #1 }
  \tl_replace_all:Nnn \l__chronos_minoryearformat_tl { ~ } { \c_space_token }
}
\cs_generate_variant:Nn \__chronos_set_minoryearformat:n { V }
\cs_generate_variant:Nn \regex_match:NnTF { NVTF }
\cs_new_protected_nopar:Nn \__chronos_set_date_aux:n 
{
  \tl_set:Nx \l__chronos_tmpc_tl { #1 }
  \regex_replace_all:NnN \c__chronos_curly_bracket {} \l__chronos_tmpc_tl
  \regex_match:NVTF \c__chronos_initial_minus \l__chronos_tmpc_tl 
  {
    \exp_last_unbraced:NV \__chronos_set_date_aux_bce:w \l__chronos_tmpc_tl \q_stop 
  }{ 
    \exp_last_unbraced:NV \__chronos_set_date_aux_ce:w \l__chronos_tmpc_tl \q_stop
  }
}
\cs_new_protected_nopar:Nn \__chronos_set_date:nnnn 
{
    \pgfcalendardatetojulian{{#1}-#2-#3}{\c@chronos@date}%
    \setcounter{chronos@#4date}{\thechronos@date}%
    \legacy_if:nF { chronos@yearzero }
    {
      \int_compare:nNnT { 0 } < { #1 }
      {
        \addtocounter{chronos@#4date}{-366}%
      }
    }
    \expandafter\def\csname chronos@#4year\endcsname{#1}%
    \expandafter\def\csname chronos@#4month\endcsname{#2}%
    \expandafter\def\csname chronos@#4day\endcsname{#3}%
}
\cs_new_protected_nopar:Npn \__chronos_set_date_aux_bce:w -#1 - #2 -  #3 - #4 @#5 \q_stop
{
  \__chronos_set_date:nnnn {-#1} {#2} {#3} {#5}
}
\cs_new_protected_nopar:Npn \__chronos_set_date_aux_ce:w #1 - #2 - #3 - #4 @#5 \q_stop
{
    \__chronos_set_date:nnnn {#1} {#2} {#3} {#5}
}
% END functions : dyddiadau
% BEGIN functions : lliwiau
\cs_new_protected_nopar:Nn \__chronos_troilliwiau:nn
{
  \clist_if_empty:cTF { g__chronos_lliwiau_#1_#2_clist }
  {
    \clist_gpop:cN { g__chronos_lliwiau_#2_clist } \l__chronos_lliw_tl
    \clist_gput_right:cV { g__chronos_lliwiau_#2_clist } \l__chronos_lliw_tl
  }{
    \clist_gpop:cN { g__chronos_lliwiau_#1_#2_clist } \l__chronos_lliw_tl
    \clist_gput_right:cV { g__chronos_lliwiau_#1_#2_clist } \l__chronos_lliw_tl
  }
}
\cs_new_nopar:Nn \__chronos_color_set_from_existing:nn { \colorlet {#1} {#2} }
% \cs_new_protected_nopar:Nn \__chronos_darparu_lliw:nn
% {
%   \color_if_exist:nF { #1 } { \color_set_eq:nn { #1 } { #2 } }
% }
% \cs_generate_variant:Nn \__chronos_darparu_lliw:nn { Vn }
% END functions : lliwiau
% BEGIN functions : enwau
\cs_new_protected_nopar:Nn \__chronos_creu_tikzname:n
{
  \int_compare:nTF { \tl_count:n { #1 } < 2 }
  {% expand unwaith os llai na 2 token yn #1 (gallu defnyddio pgffor loops i greu digwyddiadau etc.)
    \tl_set:No \l__chronos_tikzname_tl { #1 }
  }{% fel arall, peidio i ddiogelu macros fformatio (e.e. \emph{} etc.)
    \tl_set:Nn \l__chronos_tikzname_tl { #1 }
  }
  \regex_replace_all:NnN \c__chronos_enw_regex { } \l__chronos_tikzname_tl
}
\cs_new_protected_nopar:Nn \__chronos_enw_priflythrennu_eraill:n
{
  \clist_if_in:NnTF \l__chronos_llythrennau_bach_clist { #1 } { #1 } { \str_uppercase:n #1 }
}
\cs_new_protected_nopar:Nn \__chronos_enw_priflythrennu:n
{
  \tl_set:Nn \l__chronos_tmpc_tl { #1 }
  \legacy_if:nF {chronos@felymae}
  {
    \regex_replace_all:NnN \c__chronos_enw_diogelu_regex { \1 \c{__chronos_enw_priflythrennu_eraill:n} \cB{ \2 \cE} \3 } \l__chronos_tmpc_tl
    \regex_replace_all:NnN \c__chronos_enw_priflythren_cyntaf_regex { \1 \c{str_uppercase:n}\2 } \l__chronos_tmpc_tl
  }
  \l__chronos_tmpc_tl
}
\cs_generate_variant:Nn \__chronos_enw_priflythrennu:n { V,o }
% END functions : enwau
% BEGIN functions : coords purity
% \cs_generate_variant:Nn \regex_match:NnTF { Nx }
% \cs_new_protected_nopar:Nn \__chronos_coords_complete:nn
% {
% %   \tl_set:Nn \l__chronos_tmpa_tl { #1 }
%   \regex_match:NxTF \c__chronos_pure_year_regex { #1 } { \tl_set:Nn \l__chronos_tmpa_tl {chronos ~ year ~ #1} } { \tl_set:No \l__chronos_tmpa_tl {#1} }
%   \regex_match:NxTF \c__chronos_pure_year_regex { #2 } { \tl_set:Nn \l__chronos_tmpb_tl {chronos ~ year ~ #2} } { \tl_set:No \l__chronos_tmpb_tl {#2} \typeout{ no change!} }
%   \tl_show:N \l__chronos_tmpa_tl
%   \tl_show:N \l__chronos_tmpb_tl
%   \coordinate (chronos@coord@temp) at ($(\l__chronos_tmpa_tl)!1/2!(\l__chronos_tmpb_tl)$);
% }
% END functions : coords purity
% BEGIN functions: containment
\cs_new_protected_nopar:Nn \__chronos_at_begin:
{
  \cs_set_eq:NN \chronosset \@@chronosset
  \pgfsetlayers{\chronos@layers}% cadw newidiadau tu mewn i'r grwp
  \chronos@baselineskip=\baselineskip
  \cs_if_free:NT \chronosbaselineskip { \cs_new_eq:NN \chronosbaselineskip \chronos@baselineskip }
  \int_gincr:N \g__chronos_int
}
% END functions: containment
% BEGIN functions: pgf keys
% BEGIN functions: pgf keys (prop)
\cs_new_protected_nopar:Nn \__chronos_cadw_nodweddion:nnn
{% #1: tag #2 key #3 key-value list
  \prop_put:cnn { l__chronos_#1_prop } { #2 } { {#3} }
}
\cs_new_protected_nopar:Nn \__chronos_cadw_nodweddion_rhag:nn
{% #1: tag #2 key #3 key-value list
  \prop_put:Nnn \l__chronos_prop  { #1 } { {#2} }
}
\cs_generate_variant:Nn \prop_put_from_keyval:Nn { cV }
\cs_new_protected_nopar:Nn \__chronos_cadw_nodweddion_rhestr:nnn
{
  \clist_map_inline:nn { #1 }
  {
    \prop_put:cnn { l__chronos_##1_prop } { #2 } { {#3} } 
  }
}
\cs_new_protected_nopar:Nn \__chronos_ychwanegu_nodweddion:nnn
{ % roedd y problem yn #3 yn eisoes!
  \prop_get:cnNTF { l__chronos_#1_prop } { #2 } \l__chronos_tmpc_tl
   {
     \tl_set:Nn \l__chronos_tmpd_tl { #3 }
     \regex_replace_all:nnN { \\ } { \\\\ } \l__chronos_tmpd_tl
     \regex_replace_once:nnN { \}\z } { , \u{l__chronos_tmpd_tl} \} } \l__chronos_tmpc_tl
     \prop_put:cnV { l__chronos_#1_prop } { #2 } \l__chronos_tmpc_tl
   }{
     \prop_put:cnn { l__chronos_#1_prop } { #2 } { {#3} } 
   }
}
\cs_new_protected_nopar:Nn \__chronos_ychwanegu_nodweddion_rhestr:nnn
{ % ##  #1 rhestr o prop lists; #2 property; #3 value
  \clist_map_inline:nn { #1 }
  {
    \prop_get:cnNTF { l__chronos_##1_prop } { #2 } \l__chronos_tmpc_tl
    {
      \tl_set:Nn \l__chronos_tmpd_tl { #3 }
      \regex_replace_all:nnN { \\ } { \\\\ } \l__chronos_tmpd_tl
      \regex_replace_once:nnN { \}\z } { , \u{l__chronos_tmpd_tl} \} } \l__chronos_tmpc_tl
      \prop_put:cnV { l__chronos_##1_prop } { #2 } \l__chronos_tmpc_tl
    }{
      \prop_put:cnn { l__chronos_##1_prop } { #2 }  { {#3} } 
    }
  }
}
\cs_new_protected_nopar:Nn \__chronos_ychwanegu_nodweddion_rhestr_pre:nnn
{ % ##  #1 rhestr o prop lists; #2 property; #3 value
  \clist_map_inline:nn { #1 }
  {
    \prop_get:cnNTF { l__chronos_##1_prop } { #2 } \l__chronos_tmpc_tl
    {
      \tl_set:Nn \l__chronos_tmpd_tl { #3 }
      \regex_replace_all:nnN { \\ } { \\\\ } \l__chronos_tmpd_tl
      \regex_replace_once:nnN { ^\{ } { \{ \u{l__chronos_tmpd_tl} , } \l__chronos_tmpc_tl
      \prop_put:cnV { l__chronos_##1_prop } { #2 } \l__chronos_tmpc_tl
    }{
      \prop_put:cnn { l__chronos_##1_prop } { #2 }  { {#3} } 
    }
  }
}
\cs_new_protected_nopar:Nn \__chronos_ychwanegu_nodweddion_rhag:nn
{
  \prop_get:cnNTF { l__chronos_prop } { #1 } \l__chronos_tmpc_tl
  {
    \tl_set:Nn \l__chronos_tmpd_tl { #2 }
    \regex_replace_all:nnN { \\ } { \\\\ } \l__chronos_tmpd_tl
%     \regex_replace_all:nnN { ( \cP ) } { \1\1 } \l__chronos_tmpd_tl
    \regex_replace_once:nnN { \}\z } { , \u{l__chronos_tmpd_tl} \} } \l__chronos_tmpc_tl
    \prop_put:NnV \l__chronos_prop { #1 } \l__chronos_tmpc_tl
  }{
    \prop_put:Nnn \l__chronos_prop  { #1 } { {#2} } 
  }
}
\cs_new_protected_nopar:Nn \__chronos_ychwanegu_nodweddion_rhag_pre:nn
{
  \prop_get:cnNTF { l__chronos_prop } { #1 } \l__chronos_tmpc_tl
  {
    \tl_set:Nn \l__chronos_tmpd_tl { #2 }
    \regex_replace_all:nnN { \\ } { \\\\ } \l__chronos_tmpd_tl
    \regex_replace_once:nnN { ^\{ } { \{ \u{l__chronos_tmpd_tl} , } \l__chronos_tmpc_tl
    \prop_put:NnV \l__chronos_prop { #1 } \l__chronos_tmpc_tl
  }{
    \prop_put:Nnn \l__chronos_prop  { #1 } { {#2} } 
  }
}
\cs_generate_variant:Nn \prop_concat:NNN { NNc }
\cs_new_protected_nopar:Nn \__chronos_gosod_nodweddion:n
{
  % cadw status
  \prop_set_eq:NN \l__chronos_rhagosedig_prop \l__chronos_prop
  \prop_concat:NNc \l__chronos_tmpa_prop \l__chronos_prop { l__chronos_#1_prop }
  \prop_set_eq:NN \l__chronos_prop \l__chronos_tmpa_prop
  \prop_map_function:NN \l__chronos_prop \__chronos_tikzset:nn
}
\cs_generate_variant:Nn \__chronos_gosod_nodweddion:n { V }
\cs_new_protected_nopar:Nn \__chronos_ailosod_nodweddion:
{
  \prop_set_eq:NN \l__chronos_prop \l__chronos_rhagosedig_prop
  \prop_map_function:NN \l__chronos_prop \__chronos_tikzset:nn
}
\cs_new_protected_nopar:Nn \__chronos_dangos_nodweddion:n
{
  \str_case:nnF { #1 }
  {
    { life } { \prop_show:N \l__chronos_byw_prop }
    { event } { \prop_show:N \l__chronos_digwyddiad_prop }
    { period } { \prop_show:N \l__chronos_parhad_prop }
    { theory } { \prop_show:N \l__chronos_theori_prop }
    { info } { \prop_show:N \l__chronos_gwybodaeth_prop }
  }{
    \prop_show:c { l__chronos_#1_prop }
  }
}
\cs_new_protected_nopar:Nn \__chronos_dangos_nodweddion_rhag:
{
  \prop_show:N \l__chronos_prop 
}
\cs_new_protected_nopar:Nn \__chronos_tikzset:nn
{% \pgfqkeys{#1}{#2} = \pgfkeys{#1/.cd}{#2} ond yn gyflymach (Skillman a t 977)
  \pgfqkeys {/chronos} { #1/.style = #2 }
}
% END functions: pgf keys (prop)
% BEGIN functions: pgf keys (lliwiau)
\cs_new_protected_nopar:Nn \__chronos_lliwiau_cadw_rhag:
{
  \clist_map_inline:nn { byw, digwyddiad, parhad, theori }
  {
    \clist_map_inline:nn { isod, uchod }
    {
      \clist_gset_eq:cc { g__chronos_lliwiau_##1_####1_rhag_clist } { g__chronos_lliwiau_##1_####1_clist }
    }
  }
  \clist_gset_eq:NN \g__chronos_lliwiau_isod_rhag_clist \g__chronos_lliwiau_isod_clist
  \clist_gset_eq:NN \g__chronos_lliwiau_uchod_rhag_clist \g__chronos_lliwiau_uchod_clist
}
\cs_new_protected_nopar:Nn \__chronos_lliwiau_clirio:
{
  \clist_map_inline:nn { byw, digwyddiad, parhad, theori }
  {
    \clist_map_inline:nn { isod, uchod }
    {
      \clist_gset_eq:cc { g__chronos_lliwiau_##1_####1_clist } { g__chronos_lliwiau_##1_####1_rhag_clist }
    }
  }
  \clist_gset_eq:NN \g__chronos_lliwiau_isod_clist \g__chronos_lliwiau_isod_rhag_clist
  \clist_gset_eq:NN \g__chronos_lliwiau_uchod_clist \g__chronos_lliwiau_uchod_rhag_clist
}
% END functions: pgf keys (lliwiau)
% BEGIN functions: pgf keys (headings)
\cs_new_protected_nopar:Nn \__chronos_at_end:
{
  \clist_if_empty:NF \l__chronos_headings_clist
  {
    \clist_remove_duplicates:N \l__chronos_headings_clist
    \clist_map_inline:Nn \l__chronos_headings_clist
    {
      \foreach \i/\j/\k in {##1} {\testunteitl[/chronos/@amseraumawr]{\i}{\j}{\k}(chronos ~ main ~ headings)}% paid â defnyddio ';' neu dim byd yma
      \legacy_if:nT { chronos@placeholders}
      {
        \scoped[on ~ chronos ~ foreground ~ layer]
        {
          \foreach \i/\j/\k in {##1} {\draw [/chronos/placeholder ~ lines] (chronos ~ main ~ headings -| \j) edge ~ node {\j} (chronos ~ bottom -| \j) (chronos ~ main ~ headings -| \k) edge ~ node {\k} (chronos ~ bottom -| \k);}
        }
      }
    }
  }
  \clist_if_empty:NF \l__chronos_subheadings_clist
  {
    \clist_remove_duplicates:N \l__chronos_subheadings_clist
    \clist_map_inline:Nn \l__chronos_subheadings_clist
    {
      \foreach \i/\j/\k/\m in {##1} {\testunteitl[/chronos/@amserau]{\i}{\j}{\k}(\m)}% paid â defnyddio ';' neu dim byd yn y fan hon
    }
  }
  \clist_if_empty:NF \g__chronos_century_subheadings_clist
  {
    \clist_remove_duplicates:N \g__chronos_century_subheadings_clist
    \clist_map_inline:Nn \g__chronos_century_subheadings_clist
    {
      \seq_set_split:Nnn \l__chronos_tmpa_seq { / } { ##1 }
      \seq_get_left:NN \l__chronos_tmpa_seq \l__chronos_tmpc_tl
      \seq_get_right:NN \l__chronos_tmpa_seq \l__chronos_tmpd_tl
      \int_set:Nn \l__chronos_tmpb_int { 100 * \l__chronos_tmpc_tl }
      \int_set:Nn \l__chronos_tmpa_int { \l__chronos_tmpb_int - 100 }
      \testunteitl[/chronos/@amserau]{\l__chronos_tmpc_tl\l__chronos_tmpd_tl}[\l__chronos_tmpc_tl\textsuperscript{\l__chronos_tmpd_tl}c.]{chronos ~ year ~ \int_to_arabic:n {\l__chronos_tmpa_int}}{chronos ~ year ~ \int_to_arabic:n {\l__chronos_tmpb_int}}(chronos ~ lower ~ subheadings)% paid â defnyddio ';' neu dim byd yn y fan hon
    }
  }
}
% END functions: pgf keys (headings)
% BEGIN functions: pgf keys (keys)
% \__chronos_kex<whatever> functions just produce groups of pgf keys for the plain/prime/plus triple, standard/every, cy/en and combinations thereof
% tldr: reduce clutte/typing and facilitate changes/fixes (hopefully)
\cs_new_protected_nopar:Nn \__chronos_kexpander:nnnn
{% #1 enw (brif enw) | name (primary name) ; #2 llwybr/prop tag | path/prop tag ; #3 rhag | default (' or +) ; #4 tags
  \pgfqkeys{/chronos} {
    #1'/.code={
      \pgfqkeys{/chronos}{#2/.style={##1}}
      \__chronos_cadw_nodweddion_rhag:nn { #2 } { ##1 }
    },
    #1+/.code={
      \pgfqkeys{/chronos}{#2/.append ~ style={##1}}
      \__chronos_ychwanegu_nodweddion_rhag:nn { #2 } { ##1 }
    },
    #1/.forward ~ to=/chronos/#1#3,
    every ~ #1'/.code={
      \pgfqkeys{/chronos}{#2/.style/.expand ~ once={##1}}
      \__chronos_cadw_nodweddion_rhestr:nnn { #4 } { #2 } { ##1 }
      \__chronos_cadw_nodweddion_rhag:nn { #2 } { ##1 }
    },
    every ~ #1+/.code={
      \pgfqkeys{/chronos}{#2/.append ~ style/.expand ~ once={##1}}
      \__chronos_ychwanegu_nodweddion_rhestr:nnn { #4 } { #2 } { ##1 }
      \__chronos_ychwanegu_nodweddion_rhag:nn { #2 } { ##1 }
    },
    every ~ #1/.forward ~ to=/chronos/every ~ #1#3,
  }
}
\cs_new_protected_nopar:Nn \__chronos_kexpander:nnnnn
{% #1 enw | name ; #2 enw saesneg | english name ; #3 llwybr/prop tag | path/property tag ; #4 rhag | default (' or +) ; #5 tags
  \__chronos_kexpander:nnnn { #1 } { #3 } { #4 } { #5 }
  \pgfqkeys{/chronos} {
    #2'/.forward ~ to=/chronos/#1',
    #2+/.forward ~ to=/chronos/#1+,
    #2/.forward ~ to=/chronos/#1,
    every ~ #2'/.forward ~ to=/chronos/every ~ #1',
    every ~ #2+/.forward ~ to=/chronos/every ~ #1+,
    every ~ #2/.forward ~ to=/chronos/every ~ #1,
  }
}
\cs_new_protected_nopar:Nn \__chronos_kexpandtotags:nnn
{% #1 enw | name ; #2 enw saesneg | english name ; #3 rhag | default (' or +)
  \pgfqkeys{/chronos} {
    every ~ #1'/.code={
      \__chronos_cadw_nodweddion:nnn {#1}{@tag}{##1}
    },
    every ~ #1+/.code={
      \__chronos_ychwanegu_nodweddion:nnn {#1}{@tag}{##1}
    },
    every ~ #1/.forward ~ to=/chronos/every ~ #1#3,
    every ~ #2'/.forward ~ to=/chronos/every ~ #1',
    every ~ #2+/.forward ~ to=/chronos/every ~ #1+,
    every ~ #2/.forward ~ to=/chronos/every ~ #1,
  }
}
\cs_new_protected_nopar:Nn \__chronos_kextripler:nnnn
{% #1 enw | name ; #2 llwybr/prop tag | path/prop tag ; #3 rhag | default ; #4 math e.e. style neu code | type e.g. style or code
  \pgfqkeys{/chronos} {
    #2/.#4={},
    #1+/.code={
      \pgfqkeys{/chronos}{#2/.append ~ #4={##1}}
    },
    #1'/.code={%
      \pgfqkeys{/chronos}{#2/.#4={##1}}
    },
    #1/.forward ~ to=/chronos/#1#3,
  }
}
\cs_new_protected_nopar:Nn \__chronos_kexforwardtriple:nn
{%
  \pgfqkeys{/chronos} {
    #2'/.forward ~ to=/chronos/#1',
    #2+/.forward ~ to=/chronos/#1+,
    #2/.forward ~ to=/chronos/#1,
  }
}
\cs_new_protected_nopar:Nn \__chronos_kextripler:nnnnn
{% #1 enw | name ; #2 enw saesneg | english name ; #3 llwybr/prop tag | path/property tag ; #4 rhag | default ; #5 math e.e. style neu code | type e.g. style or code
  \__chronos_kextripler:nnnn { #1 } { #3 } { #4 } { #5 }
  \__chronos_kexforwardtriple:nn { #1 } { #2 }
}
\cs_new_protected_nopar:Nn \__chronos_kexforwarder:nn
{% #1 llwybr/enw | path/name ; #2 rhestr allweddau newydd | list of new keys
  \clist_map_inline:nn { #2 }
  {
    \pgfqkeys{/chronos} { ##1/.forward ~ to=/chronos/#1 }
  }
}
\cs_new_protected_nopar:Nn \__chronos_kexforwarder:nnn
{% #1 llwybr | path ; #2 enw | name ; #3 rhestr allweddau newydd ar yr un llwybr | list of new keys on the same path
  \clist_map_inline:nn { #3 }
  {
    \pgfqkeys{/chronos/#1} { ##1/.forward ~ to=/chronos/#1/#2 }
  }
}
\cs_new_protected_nopar:Nn \__chronos_kexkeymaker:nnn
{
  \clist_map_inline:nn { byw, digwyddiad, parhad, theori, gwybodaeth, prif }
  {
    \pgfqkeys{/chronos/##1} { #1/.#2={#3} }
  }
}
% END functions: pgf keys (keys)
% END functions: pgf keys
\cs_generate_variant:Nn \legacy_if:nTF { oTF }
% joseph wright: https://chat.stackexchange.com/transcript/message/65523217#65523217
\cs_new_eq:NN \__chronos_keys_set_exclude_groups:nnn \keys_set_exclude_groups:nnn
\cs_if_exist:NF \__chronos_keys_set_exclude_groups:nnn
{
  \cs_new_eq:NN \__chronos_keys_set_exclude_groups:nnn \keys_set_filter:nnn
}
% END functions
% BEGIN macros y paced **mewnol hefyd!** | **internal also!**
% Ddylwn i ddefnyddio \NewDocumentCommand (ond *mewnol*?), \newcommand/\newcommand*, \def/\gdef/\edef/\xdef, \cs_new_eq:NN, \let neu rhywbeth arall??!!
\newcommand* \chronos@tikzprefix { \int_to_arabic:n { \g__chronos_int } }
\cs_new_eq:NN \chronos@env@begin \__chronos_at_begin:
\cs_new_eq:NN \chronos@setdateformat \__chronos_set_dateformat:n
\cs_new_eq:NN \chronos@setyearformat \__chronos_set_yearformat:n
\cs_new_eq:NN \chronos@setminoryearformat \__chronos_set_minoryearformat:n 
% for pgf/tikz convenience
\NewDocumentCommand \chronos@showdate { o m }
{
  \group_begin:
    \IfValueT { #1 }
    {
      \__chronos_set_dateformat:n { #1 }
    }
    \pgfcalendarjuliantoweekday{\csname thechronos@#2date\endcsname}{\c@chronos@weekday}%
    \__chronos_show_date:n { #2 }
  \group_end:
}
\NewDocumentCommand \chronos@showdate@cs { o m }
{
  \group_begin:
    \IfValueT { #1 }
    {
      \__chronos_set_dateformat:v { #1 }
    }
    \pgfcalendarjuliantoweekday{\csname thechronos@#2date\endcsname}{\c@chronos@weekday}%
    \__chronos_show_date:n { #2 }
  \group_end:
}
\NewDocumentCommand \chronos@showyear { o m }
{
  \group_begin:
    \IfValueT { #1 }
    {
      \tl_set:No \l__chronos_tmpc_tl { #1 }
      \tl_if_empty:NF \l__chronos_tmpc_tl
      {
        \__chronos_set_yearformat:V \l__chronos_tmpc_tl
      }
    }
    \__chronos_show_year:n { #2 }
  \group_end:
}
% \cs_new_eq:NN \chronos@minoryearformat  
\newcommand* \chronos@minoryearformat { \l__chronos_minoryearformat_tl }
\newcommand* \chronos@troilliwiau@uchod [1] [byw] {% O {byw}
  \__chronos_troilliwiau:nn { #1 } { uchod }
  \expandafter\def\csname chronos@#1@lliw\endcsname{\l__chronos_lliw_tl}
}
\newcommand* \chronos@troilliwiau@isod [1] [byw] {% O {byw} 
  \__chronos_troilliwiau:nn { #1 } { isod }
  \expandafter\def\csname chronos@#1@lliw\endcsname{\l__chronos_lliw_tl}
}
\NewDocumentCommand \chronos@lliwiau@uchod { o m }
{
  \IfValueTF { #1 } { \tl_set:Nn \l__chronos_tmpc_tl { _#1 } }{ \tl_clear:N \l__chronos_tmpc_tl }
  \clist_gset:cn { g__chronos_lliwiau \l__chronos_tmpc_tl _uchod_clist } { #2 }
}
\NewDocumentCommand \chronos@lliwiau@isod { o m }
{
  \IfValueTF { #1 } { \tl_set:Nn \l__chronos_tmpc_tl { _#1 } }{ \tl_clear:N \l__chronos_tmpc_tl }
  \clist_gset:cn { g__chronos_lliwiau \l__chronos_tmpc_tl _isod_clist } { #2 }
}
\cs_new_eq:NN \chronos@lliwiau@clear \__chronos_lliwiau_clirio:
\cs_new_eq:NN \chronos@lliwiau@cadw@rhag \__chronos_lliwiau_cadw_rhag:
% enwau
\newcommand* \chronos@creu@tikzname [2] {% m m
  \__chronos_creu_tikzname:n { #2 }
  \expandafter\let\csname chronos@#1@tikzname\endcsname \l__chronos_tikzname_tl
}
\cs_new_eq:NN \chronos@enw@priflythrennu \__chronos_enw_priflythrennu:V 
\cs_new_eq:NN \chronos@testunteitl@priflythrennu \__chronos_enw_priflythrennu:n 
% \NewDocumentCommand \chronos@coords@completion { m m }
% {
%   \__chronos_coords_complete:nn { #1 }{ #2 }
% }
\cs_new_eq:NN \chronos@cadw@nodweddion@rhag \__chronos_cadw_nodweddion_rhag:nn 
\cs_new_eq:NN \chronos@cadw@nodweddion  \__chronos_cadw_nodweddion:nnn
\cs_new_eq:NN \chronos@ychwanegu@nodweddion \__chronos_ychwanegu_nodweddion:nnn 
\NewDocumentCommand \chronos@ychwanegu@nodweddion@rhestr { s t {^} m m m }
{
  \IfBooleanTF { #2 }
  {
    \__chronos_ychwanegu_nodweddion_rhestr_pre:nnn { #3 }{ #4 }{ #5 }
    \IfBooleanT { #1 } { \__chronos_ychwanegu_nodweddion_rhag_pre:nn { #4 }{ #5 } }
  }{
    \__chronos_ychwanegu_nodweddion_rhestr:nnn { #3 }{ #4 }{ #5 }
    \IfBooleanT { #1 } { \__chronos_ychwanegu_nodweddion_rhag:nn { #4 }{ #5 } }
  }
}
\NewDocumentCommand \chronos@cadw@nodweddion@rhestr { s m m m }
{
  \__chronos_cadw_nodweddion_rhestr:nnn { #2 }{ #3 }{ #4 }
  \IfBooleanT { #1 } { \__chronos_cadw_nodweddion_rhag:nn { #3 }{ #4 } }
}
\cs_new_eq:NN \chronos@ychwanegu@nodweddion@rhag \__chronos_ychwanegu_nodweddion_rhag:nn 
\cs_new_eq:NN \chronos@gosod@nodweddion \__chronos_gosod_nodweddion:n 
\cs_new_eq:NN \chronos@gosod@nodweddion@var \__chronos_gosod_nodweddion:V 
\cs_new_eq:NN \chronos@ailosod@nodweddion \__chronos_ailosod_nodweddion: 
\cs_new_eq:NN \chronos@dangos@nodweddion \__chronos_dangos_nodweddion:n 
\cs_new_eq:NN \chronos@dangos@nodweddion@rhag \__chronos_dangos_nodweddion_rhag: 
\newcommand* \chronos@ychwanegu@gosod [1] 
{
  \legacy_if:nF { chronos@preset } { 
    \clist_map_inline:nn { #1 }
    {
      \seq_put_right:Nn \l__chronos_gosod_seq {##1}
    }
  } 
}%
\newcommand* \chronos@dangos@gosod { \seq_show:N \l__chronos_gosod_seq }%
\newcommand* \chronos@if@gosodTF [3] { \seq_if_in:NnTF \l__chronos_gosod_seq { #1 } { #2 } { #3 } }%
% \newcommand* \chronos@if@gosodT [2] { \seq_if_in:NnT \l__chronos_gosod_seq { #1 } { #2 } }%
\newcommand* \chronos@if@gosodF [2] { \chronos@presettrue \seq_if_in:NnF \l__chronos_gosod_seq { #1 } { #2 } \chronos@presetfalse }%
\NewDocumentCommand \chronos@dangos@lliwiau { s O { byw, digwyddiad, parhad, theori } D () { isod, uchod }  } 
{
  \clist_set:Nn \l__chronos_tmpb_clist { #2 }
  \clist_set:Nn \l__chronos_tmpc_clist { #3 }
  \clist_map_inline:Nn \l__chronos_tmpb_clist
  {
    \clist_map_inline:Nn \l__chronos_tmpc_clist
    {
      \clist_show:c { g__chronos_lliwiau_##1_####1_clist }
    }
  }
  \IfBooleanT { #1 }
  {
    \clist_map_inline:Nn \l__chronos_tmpc_clist
    {
      \clist_show:c {g__chronos_lliwiau_##1_clist}
    }
  }
}
\NewDocumentCommand \chronos@dangos@lliwiau@rhag { s O { byw, digwyddiad, parhad, theori } D () { isod, uchod }  } 
{
  \clist_set:Nn \l__chronos_tmpb_clist { #2 }
  \clist_set:Nn \l__chronos_tmpc_clist { #3 }
  \clist_map_inline:Nn \l__chronos_tmpb_clist
  {
    \clist_map_inline:Nn \l__chronos_tmpc_clist
    {
      \clist_show:c { g__chronos_lliwiau_##1_####1_rhag_clist }
    }
  }
  \IfBooleanT { #1 }
  {
    \clist_map_inline:Nn \l__chronos_tmpc_clist
    {
      \clist_show:c {g__chronos_lliwiau_##1_rhag_clist}
    }
  }
}
\cs_new_eq:NN \chronosdangoslliwiau \chronos@dangos@lliwiau
\cs_new_eq:NN \chronosdangoslliwiaurhag \chronos@dangos@lliwiau@rhag
\newcommand* \chronos@dangos@fformatiaudyddiadau{%
  \clist_map_inline:nn { \l__chronos_dateformat_tl, \l__chronos_yearformat_tl, \l__chronos_minoryearformat_tl}
  { \tl_show:N ##1 }
}
\cs_new_eq:NN \chronosdangosfformatiaudyddiadau \chronos@dangos@fformatiaudyddiadau
\NewDocumentCommand \chronos@to@clist { t {+} m m }
{
  \IfBooleanTF { #1 }
  {
    \clist_put_right:co { l__chronos_#2_clist } { #3 }
  }{
    \clist_set:co { l__chronos_#2_clist } { #3 }
  }
}
\NewDocumentCommand \chronos@global@to@clist { s t {+} m m }
{
  \IfBooleanTF { #2 }
  {
    \IfBooleanTF { #1 }
    {
      \clist_gput_right:cx { g__chronos_#3_clist } { #4 }
    }{
      \clist_gput_right:co { g__chronos_#3_clist } { #4 }
    }
  }{
    \IfBooleanTF { #1 }
    {
      \clist_gset:cx { g__chronos_#3_clist } { #4 }
    }{
      \clist_gset:co { g__chronos_#3_clist } { #4 }
    }
  }
}
\newcommand* \chronos@global@clear@to@clist [1] {% m
    \clist_gclear:c { g__chronos_#1_clist }
}
\newcommand* \chronos@from@clist [2] {% m m
  \clist_remove_duplicates:c { l__chronos_#1_clist }
  \clist_if_empty:cTF { l__chronos_#1_clist }
  {
    \expandafter\let#2\@empty
  }{
    \expandafter\let\expandafter#2\csname l__chronos_#1_clist\endcsname
  }
}
\newcommand* \chronos@global@from@clist [1] {
  \clist_use:cn { g__chronos_#1_clist } { , }
}
\newcommand* \chronos@global@eq@clist [2] {
  \clist_gset_eq:cc { g__chronos_#1_clist } { g__chronos_#2_clist }
}
\newcommand* \chronos@dangos@clist [1] { \clist_show:c { #1_clist } }
\cs_new_eq:NN \chronos@at@end  \__chronos_at_end:  
\cs_new_eq:NN \chronos@set@date@aux \__chronos_set_date_aux:n
\cs_new_eq:NN \chronos@set@date \__chronos_set_date:nnnn  % blwyddyn; mis; dydd; tag for macro
% \newcommand* \chronos@if@lliw [3] { \color_if_exist:nTF { #1 } { #2 } { #3 } }
\cs_new_eq:NN \chronos@legacy@if \legacy_if:oTF 
% \cs_new_eq:NN \chronos@legacy@if@set \legacy_if_set:nn
\newcommand* \chronos@legacy@if@set [2] {\cs:w #1#2\cs_end:}
\def\chronos@datetojulian@extractyear #1-#2-#3 {#1}
\NewDocumentCommand \chronos@dangoslliw { s O {\chronos@temp@lliw} m }{\extractcolorspec{#3}{#2}\IfBooleanT{#1}{\show#2}}
\cs_new_eq:NN \chronos@keymaker \__chronos_kexkeymaker:nnn
% END macros y paced
% BEGIN yn lle etoolbox
% yn lle \ifundef o etoolbox
\cs_if_exist:NTF \IfFreeTF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfFreeTF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfFreeTF \cs_if_free:NTF }
\cs_if_exist:NTF \IfFreeT {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfFreeT. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfFreeT \cs_if_free:NT }
\cs_if_exist:NTF \IfFreeF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfFreeF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfFreeF \cs_if_free:NF }
% yn lle \ifdef o etoolbox
\cs_if_exist:NTF \IfExistTF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfExistTF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfExistTF \cs_if_exist:NTF }
\cs_if_exist:NTF \IfExistT {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfExistT. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfExistT \cs_if_exist:NT }
\cs_if_exist:NTF \IfExistF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfExistF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfExistF \cs_if_exist:NF }
% yn lle \ifcsundef o etoolbox
\cs_if_exist:NTF \IfCSFreeTF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSFreeTF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfCSFreeTF \cs_if_free:cTF }
\cs_if_exist:NTF \IfCSFreeT {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSFreeT. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfCSFreeT \cs_if_free:cT }
\cs_if_exist:NTF \IfCSFreeF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSFreeF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfCSFreeF \cs_if_free:cF }
% yn lle \ifcsdef o etoolbox
\cs_if_exist:NTF \IfCSExistTF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSExistTF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfCSExistTF \cs_if_exist:cTF }
\cs_if_exist:NTF \IfCSExistT {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSExistT. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfCSExistT \cs_if_exist:cT }
\cs_if_exist:NTF \IfCSExistF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfCSExistF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfCSExistF \cs_if_exist:cF }
% yn lle \undef o etoolbox
\cs_if_exist:NTF \Undefine {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\Undefine. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \Undefine \cs_undefine:N }
% yn lle \csletcs o etoolbox
\cs_if_exist:NTF \CSletCS {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\CSletCS. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \CSletCS \cs_set_eq:cc }
% yn lle \cslet o etoolbox
\cs_if_exist:NTF \CSlet {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\CSlet. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \CSlet \cs_set_eq:cN }
% yn lle \ifboolexpr o etoolbox (ish)
\cs_if_exist:NTF \IfBooleanExprTF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfBooleanExprTF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfBooleanExprTF \bool_if:nTF }
\cs_if_exist:NTF \IfBooleanExprT {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfBooleanExprT. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfBooleanExprT \bool_if:nT }
\cs_if_exist:NTF \IfBooleanExprF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfBooleanExprF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfBooleanExprF \bool_if:nF }
% yn lle bool o etoolbox (ish)
\cs_if_exist:NTF \LegacyBoolean {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\LegacyBoolean. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \LegacyBoolean \legacy_if_p:n }
% yn lle test o etoolbox (ish)
\cs_if_exist:NTF \CSFreeBoolean {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\CSFreeBoolean. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \CSFreeBoolean \cs_if_free_p:N }
% yn lle \ifnumcomp o etoolbox (ish)
\cs_if_exist:NTF \IntCompareBoolean {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IntCompareBoolean. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IntCompareBoolean \int_compare_p:nNn }
\cs_if_exist:NTF \IfIntCompareTF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfIntCompareTF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfIntCompareTF \int_compare:nTF }
\cs_if_exist:NTF \IfIntCompareT {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfIntCompareT. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfIntCompareT \int_compare:nT }
\cs_if_exist:NTF \IfIntCompareF {\PackageWarning{chronos}{Refusing ~ to ~ overwrite ~ existing ~ \protect\IfIntCompareF. ~ This ~ may ~ not ~ work} } { \cs_new_eq:NN  \IfIntCompareF \int_compare:nF }
% END yn lle etoolbox
% BEGIN macros y paced cyhoeddus | public package macros
\NewDocumentCommand \chronosnewcolourscheme { O {rhagosedig} m m }
{
  \group_begin:
    \cs_new_nopar:cn { __chronos_lliwiau_#2 : }
    {
      \cs:w chronos@lliwiau@#1 \cs_end:
      \keys_set_groups:nnn { chronos / lliwiau } { core } { #3 }
      \__chronos_color_set_from_existing:nn { chronos@lliw@cefndir@llinell } { chronos@prifliw }
      \__chronos_color_set_from_existing:nn { chronos@lliw@llinell } { chronos@prifliw@cefndir }
      \keys_set_groups:nnn { chronos / lliwiau } { core ~ derivative } { #3 }
      \__chronos_color_set_from_existing:nn { chronos@borderinner } { chronos@lliw@cefndir@llinell }
      \__chronos_color_set_from_existing:nn { chronos@borderouter } { chronos@prifliw@cefndir }
      \__chronos_color_set_from_existing:nn { chronos@bordermiddle } { chronos@borderinner!50!chronos@borderouter }
      \keys_set_groups:nnn { chronos / lliwiau } { core ~ border } { #3 }
      \__chronos_color_set_from_existing:nn { chronos@byw@lliw@rhagosodedig } { chronos@prifliw } 
      \__chronos_color_set_from_existing:nn { chronos@digwyddiad@lliw@rhagosodedig } { chronos@prifliw } 
      \__chronos_color_set_from_existing:nn { chronos@parhad@lliw@rhagosodedig } { chronos@prifliw } 
      \__chronos_color_set_from_existing:nn { chronos@theori@lliw@rhagosodedig } { chronos@prifliw } 
      \__chronos_color_set_from_existing:nn { chronos@gwybodaeth@lliw@rhagosodedig } { chronos@prifliw } 
      % oedd \keys_set_filter:nnn
      \__chronos_keys_set_exclude_groups:nnn { chronos / lliwiau } { core, core ~ derivative, core ~ border } { #3 }
      \@ifpackageloaded{memoize}
      {
        \mmzset { csname ~ meaning ~ to ~ context={ __chronos_lliwiau_#2 : } }
      }{}
    }
    \cs_new_eq:cc  { chronos@lliwiau@#2 } { __chronos_lliwiau_#2 : }
  \group_end:
}
\cs_new_eq:NN \chronosnewcolorscheme \chronosnewcolourscheme
% END macros y paced cyhoeddus | public package macros
\ExplSyntaxOff
% END expl3
% BEGIN hydoedd 2e
% \newlength{\chronos@amser@dechraulength}
% \newlength{\chronos@amser@diweddlength}
\newlength{\chronos@diwedd@diwedd}
\newlength{\chronos@dechrau@dechrau}
\newlength{\chronos@byw@border}
\newlength{\chronos@parhad@border}
\newlength{\chronos@digwyddiad@border}
\newlength{\chronos@byw@border@inv}
\newlength{\chronos@parhad@border@inv}
\newlength{\chronos@digwyddiad@border@inv}
% \newlength{\chronos@width}
\newlength{\chronos@templgtha}
\newlength{\chronos@templgthb}
\newlength{\chronos@templgthc}
% END hydoedd 2e
% BEGIN dimens
\newdimen\chronos@borderheight
\newdimen\chronos@height
\newdimen\chronos@width
\chronos@width=\textwidth
\newdimen\chronos@eramargin
\newdimen\chronos@timelinemargin
\newdimen\chronos@inner@halfheight
\newdimen\chronos@outer@halfheight
% \newdimen\chronos@timelineunitlength
\newdimen\chronos@pgflinewidth@saved
\newdimen\chronos@border@de
\newdimen\chronos@border@chwith
\newdimen\chronos@border@penawdau
\newdimen\chronos@border@pen
\newdimen\chronos@border@gwaelod
\newdimen\chronos@border@allanol
\newdimen\chronos@subheading@drop@uchod
\newdimen\chronos@subheading@drop@isod
\newdimen\chronos@heading@drop
\newdimen\chronos@llinell@yshift
\newdimen\chronos@testun@yshift
\newdimen\chronos@baselineskip
\newdimen\chronos@cylchtheori@mawr
\newdimen\chronos@cylchtheori@bach
\newdimen\chronos@tmpdimena
\newdimen\chronos@tmpdimenb
\chronos@testun@yshift=5pt
\chronos@height=\pi pt
\chronos@borderheight=\pi pt
\chronos@llinell@yshift=\pi pt
\chronos@timelinemargin=15pt
\chronos@eramargin=15pt
\chronos@border@allanol=5pt
\chronos@border@penawdau=\pi pt
\chronos@border@pen=0pt
\chronos@border@de=0pt
\chronos@border@gwaelod=0pt
\chronos@border@chwith=0pt
\chronos@cylchtheori@mawr=15pt
\chronos@cylchtheori@bach=9pt
% END dimens
% BEGIN rhifyddion 2e
\newcounter{chronos@date}
\newcounter{chronos@startdate}
\newcounter{chronos@enddate}
\newcounter{chronos@startyear}
\newcounter{chronos@startmarkyear}
\newcounter{chronos@endyear}
\newcounter{chronos@yeardate}
\newcounter{chronos@thingdate}
\newcounter{chronos@otherthingdate}
\newcounter{chronos@genidate}
\newcounter{chronos@marwdate}
\newcounter{chronos@digdate}
\newcounter{chronos@weekday}
\newcounter{chronos@theori@countanchors}
\newcounter{chronos@tempcnta}
\newcounter{chronos@tempcntb}
\newcounter{chronos@tempcntc}
\newcounter{chronos@tempadate}
\newcounter{chronos@tempbdate}
\newcounter{chronos@bagpuss}
% END rhifyddion 2e
% BEGIN amodol
\newif\ifchronos@marks
\chronos@markstrue
\newif\ifchronos@marks@minor
\chronos@marks@minortrue
\newif\ifchronos@marks@bare
\chronos@marks@barefalse
\newif\ifchronos@timeline@showyears
\chronos@timeline@showyearstrue
\newif\ifchronos@eventyearsonline
\chronos@eventyearsonlinefalse
\newif\ifchronos@yearzero
\chronos@yearzerofalse
\newif\ifchronos@markateraswitch
\chronos@markateraswitchfalse
\newif\ifchronos@onlytext
\chronos@onlytextfalse
\newif\ifchronos@markeras
\chronos@markerasfalse
\newif\ifchronos@yearsonline
\chronos@yearsonlinefalse
\newif\ifchronos@eventdatessplit
\chronos@eventdatessplitfalse
\newif\ifchronos@minoryears
\chronos@minoryearstrue
\newif\ifchronos@byw@isod
\chronos@byw@isodfalse
\newif\ifchronos@byw@isod@rhag
\chronos@byw@isod@rhagfalse
\newif\ifchronos@every@byw@isod
\chronos@every@byw@isodfalse
\newif\ifchronos@every@byw@uchod
\chronos@every@byw@uchodfalse
\newif\ifchronos@byw@cysylltiad
\chronos@byw@cysylltiadtrue
\newif\ifchronos@byw@cysylltiadtheori
\chronos@byw@cysylltiadtheorifalse
\newif\ifchronos@digwyddiad@isod
\chronos@digwyddiad@isodfalse
\newif\ifchronos@digwyddiad@isod@rhag
\chronos@digwyddiad@isod@rhagfalse
\newif\ifchronos@every@digwyddiad@isod
\chronos@every@digwyddiad@isodfalse
\newif\ifchronos@every@digwyddiad@uchod
\chronos@every@digwyddiad@uchodfalse
\newif\ifchronos@digwyddiad@cysylltiad
\chronos@digwyddiad@cysylltiadtrue
\newif\ifchronos@digwyddiad@cysylltiadtheori
\chronos@digwyddiad@cysylltiadtheorifalse
\newif\ifchronos@parhad@isod
\chronos@parhad@isodfalse
\newif\ifchronos@parhad@isod@rhag
\chronos@parhad@isod@rhagfalse
\newif\ifchronos@every@parhad@isod
\chronos@every@parhad@isodfalse
\newif\ifchronos@every@parhad@uchod
\chronos@every@parhad@uchodfalse
\newif\ifchronos@parhad@cysylltiad
\chronos@parhad@cysylltiadtrue
\newif\ifchronos@parhad@cysylltiadtheori
\chronos@parhad@cysylltiadtheorifalse
\newif\ifchronos@theori@isod
\chronos@theori@isodfalse
\newif\ifchronos@theori@cysylltiadtheori
\chronos@theori@cysylltiadtheorifalse
\newif\ifchronos@cam@mod
\newif\ifchronos@middleanchorborder
\newif\ifchronos@troilliwiau
\chronos@troilliwiautrue
\newif\ifchronos@dangoscyfnodau
\chronos@dangoscyfnodautrue
\newif\ifchronos@felymae
\chronos@felymaefalse
\newif\ifchronos@temp
\chronos@temptrue
\newif\ifchronos@headings
\chronos@headingsfalse
\newif\ifchronos@frame
\chronos@framefalse
\newif\ifchronos@framedefnyddiobb
\chronos@framedefnyddiobbtrue
\newif\ifchronos@placeholders
\chronos@placeholdersfalse
\newif\ifchronos@showcoords
\chronos@showcoordsfalse
\newif\ifchronos@showbb
\chronos@showbbfalse
\newif\ifchronos@shownodes
\chronos@shownodesfalse
\newif\ifchronos@bufarw
\chronos@bufarwtrue
\newif\ifchronos@gorffenedig
\chronos@gorffenedigtrue
\newif\ifchronos@preset
\chronos@presettrue
\newif\ifchronos@blynyddoedduchod
\chronos@blynyddoedduchodfalse
\newif\ifchronos@blynyddoeddisod
\chronos@blynyddoeddisodfalse
\newif\ifchronos@dimondblynyddoedd
\chronos@dimondblynyddoeddfalse
\newif\ifchronos@tag@cysylltu
\chronos@tag@cysylltutrue
\newif\ifchronos@copyleft
\chronos@copyleftfalse
\newif\ifchronos@phantom
\chronos@phantomfalse
\newif\ifchronostimelinearrow
\chronostimelinearrowfalse
% END amodol
% BEGIN pre-defined macros
\let\chronos@coords\@empty
\def\chronos@ce{CE}
\def\chronos@bce{BCE}
\def\chronos@yearce{\textsc{ce}}
\def\chronos@yearbce{\textsc{bce}}
\def\chronos@yshift{0pt}
\def\chronos@ffont@camaumawr{\sffamily\bfseries}
\def\chronos@ffont@camaubach{\sffamily}
\def\chronos@ffont@cyfnodau{\sffamily\bfseries}
% \def\chronos@width{\textwidth}
\def\chronos@uchod{0}
\def\chronos@isod{0}
% END pre-defined macros

% addaswyd o ateb Martin Scharrer: https://tex.stackexchange.com/a/56405/
% i ddefnyddio \setto<dim> macros y tu mewn i lluniau tikz
% to use \setto<dim> macros inside tikz pictures
% LPPL permission: https://tex.stackexchange.com/users/2975/martin-scharrer
\let\orig@settodim\@settodim
\let\chronos@settodim\@settodim
\patchcmd{\chronos@settodim}{\setbox\@tempboxa\hbox}{\chronos@tikz@setbox}{}{}
\def\chronos@tikz@setbox#1{%
  \setbox\@tempboxa\hbox{\pgfinterruptpicture #1\endpgfinterruptpicture}%
}
\appto\tikz@installcommands{%
  \let\@settodim\chronos@settodim
}
\appto\tikz@uninstallcommands{%
  \let\@settodim\orig@settodim
}

% BEGIN lliwiau
\definecolorset{rgb}{chronos}{}{% xcolor.sty, x11names.def,svgnames.def
  Blue,0,0,1;%
  Blue3,0,0,.804;%
  DarkGoldenrod1,1,.725,.06;%
  DarkGray,.664,.664,.664;%
  DarkOrange1,1,.498,0;%
  DarkOrchid3,.604,.196,.804;%
  DarkSlateGrey,.185,.31,.31;%
  DeepPink2,.932,.07,.536;%
  DeepSkyBlue2,0,.698,.932;%
  DodgerBlue1,.116,.565,1;%
  DodgerBlue2,.11,.525,.932;%
  DodgerBlue3,.094,.455,.804;%
  DodgerBlue4,.064,.305,.545;%
  Firebrick1,1,.19,.19;%
  ForestGreen,.132,.545,.132;%
  Green,0,.5,0;%
  Green3,0,.804,0;%
  Ivory2,.932,.932,.88;%
  Ivory3,.804,.804,.756;%
  Ivory4,.545,.545,.512;%
  Lavender,.9,.9,.98;%
  LavenderBlush1,1,.94,.96;%
  LavenderBlush2,.932,.88,.898;%
  LavenderBlush3,.804,.756,.772;%
  LavenderBlush4,.545,.512,.525;%
  MediumPurple,.576,.44,.86;%
  MidnightBlue,.098,.098,.44;%
  MistyRose2,.932,.835,.824;%
  MistyRose3,.804,.716,.71;%
  MistyRose4,.545,.49,.484;%
  Orange,1,.648,0;%
  OrangeRed1,1,.27,0;%
  Purple0,.628,.125,.94;%
  Red,1,0,0;%
  SeaGreen3,.264,.804,.5;%
  Seashell2,.932,.898,.87;%
  Seashell3,.804,.772,.75;%
  Seashell4,.545,.525,.51;%
  Silver,.752,.752,.752;%
  SpringGreen4,0,.545,.27;%
  Thistle2,.932,.824,.932;%
  Thistle3,.804,.71,.804;%
  Thistle4,.545,.484,.545;%
  Violet,.932,.51,.932;%
  Yellow,1,1,0;%
  darkgray,.25,.25,.25%
}
% dvipsnames.def
\definecolor{chronosCerulean}      {cmyk}{0.94,0.11,0,0}
\definecolor{chronosPeriwinkle}    {cmyk}{0.57,0.55,0,0}
\definecolor{chronosWildStrawberry}{cmyk}{0,0.96,0.39,0}
\newcommand*\chronos@lliwiau@cronoleg{%
  \chronos@lliwiau@isod{chronosRed,chronosOrange,chronosYellow,chronosGreen,chronosBlue,chronosMidnightBlue,chronosViolet}%
  \chronos@lliwiau@uchod{chronosRed,chronosOrange,chronosYellow,chronosGreen,chronosBlue,chronosMidnightBlue,chronosViolet}%
  \chronos@lliwiau@isod[byw]{chronosDodgerBlue3,chronosGreen3,chronosBlue3,chronosSpringGreen4,chronosDeepSkyBlue2,chronosForestGreen,chronosPeriwinkle,chronosSeaGreen3}%
  \chronos@lliwiau@uchod[byw]{chronosDeepPink2,chronosDarkOrange1,chronosFirebrick1,chronosPurple0,chronosWildStrawberry,chronosOrangeRed1,chronosDarkGoldenrod1,chronosDarkOrchid3}%
  \chronos@lliwiau@isod[digwyddiad]{chronosSeashell4,chronosSeashell4!.5!chronosSeashell3,chronosSeashell3,chronosSeashell3!.5!chronosSeashell2,chronosSeashell2}%
  \chronos@lliwiau@uchod[digwyddiad]{chronosThistle4,chronosThistle4!.5!chronosThistle3,chronosThistle3,chronosThistle3!.5!chronosThistle2,chronosThistle2}%
  \chronos@lliwiau@isod[parhad]{chronosIvory4,chronosIvory4!.5!chronosIvory3,chronosIvory3,chronosIvory3!.5!chronosIvory2,chronosIvory2}%
  \chronos@lliwiau@uchod[parhad]{chronosMistyRose4,chronosMistyRose4!.5!chronosMistyRose3,chronosMistyRose3,chronosMistyRose3!.5!chronosMistyRose2,chronosMistyRose2}%
  % BEGIN lliwiau prif
  \colorlet{chronos@prifliw}{black}% prifliw
  \colorlet{chronos@prifliw@cefndir}{white}% prifliw cefndir
  \colorlet{chronos@lliw@cefndir@llinell}{black}% oedd lliw cefndir amser?
  \colorlet{chronos@lliw@llinell}{white}% oedd lliw amser
%   \colorlet{chronos@lliw@cefndir}{white}% lliw cefndir
  % angen y ffurf gywir
  % yn wreiddiol, 'gwybodaeth' oedd theori ac 'ee' oedd gwybodaeth
  \colorlet{chronos@lliw@theori}{white}%
  \colorlet{chronos@lliw@cefndir@theori}{black}%
  \colorlet{chronos@lliw@cefndir@gwybodaeth}{chronos@prifliw!25!chronos@prifliw@cefndir}% lliw cefndir ee = prifliw!25!prifliw cefndir
  \colorlet{chronos@lliw@gwybodaeth}{chronos@prifliw}% lliw ee = prifliw
  % \colorlet{chronos@lliw@symbolau@cefndir}{chronos@lliw@cefndir}% lliw symbolau cefndir = lliw cefndir
  % \colorlet{chronos@lliw@symbolau}{chronos@prifliw}% lliw symbolau = prifliw
%   \colorlet{lliw dig}{prifliw!75!prifliw cefndir}
  % END lliwiau prif
}
\newcommand*\chronos@lliwiau@rhagosodedig{%
  \chronos@lliwiau@isod{chronosRed,chronosOrange,chronosYellow,chronosGreen,chronosBlue,chronosMidnightBlue,chronosViolet}%
  \chronos@lliwiau@uchod{chronosRed,chronosOrange,chronosYellow,chronosGreen,chronosBlue,chronosMidnightBlue,chronosViolet}%
  % BEGIN lliwiau prif
  \colorlet{chronos@prifliw}{black}% prifliw
  \colorlet{chronos@prifliw@cefndir}{white}% prifliw cefndir
  \colorlet{chronos@lliw@cefndir@llinell}{black}% oedd lliw cefndir amser?
  \colorlet{chronos@lliw@llinell}{white}% oedd lliw amser
%   \colorlet{chronos@lliw@cefndir}{white}% lliw cefndir
  % angen y ffurf gywir
  % yn wreiddiol, 'gwybodaeth' oedd theori ac 'ee' oedd gwybodaeth
  \colorlet{chronos@lliw@theori}{white}%
  \colorlet{chronos@lliw@cefndir@theori}{black}%
  \colorlet{chronos@lliw@cefndir@gwybodaeth}{chronos@prifliw!25!chronos@prifliw@cefndir}% lliw cefndir ee = prifliw!25!prifliw cefndir
  \colorlet{chronos@lliw@gwybodaeth}{chronos@prifliw}% lliw ee = prifliw
  % \colorlet{chronos@lliw@symbolau@cefndir}{chronos@lliw@cefndir}% lliw symbolau cefndir = lliw cefndir
  % \colorlet{chronos@lliw@symbolau}{chronos@prifliw}% lliw symbolau = prifliw
%   \colorlet{lliw dig}{prifliw!75!prifliw cefndir}
  \colorlet{chronos@borderouter}{chronos@prifliw@cefndir}%
  \colorlet{chronos@borderinner}{chronos@lliw@cefndir@llinell}%
  \colorlet{chronos@bordermiddle}{chronos@borderouter!50!chronos@borderinner}%
  % END lliwiau prif
}
% END lliwiau
% rhagosodedig
\chronos@lliwiau@rhagosodedig
\let\chronos@lliwiau@default\chronos@lliwiau@rhagosedig
% \chronos@lliwiau@cronoleg

\NewDocumentCommand \testunteitl { O {/chronos/@amserau} m o m m r() }{%
%   #1: opsiwn: style for node
%   #2: enw sy'n cael ei ddefnyddio dwywaith -> node name + node content (\chronos@testunteitl@priflythrennu)
%   #3: opsiwn: content y node 
%   #4: first node for horizontal (x) placement
%   #5: second node for horizontal (x) placement (average taken)
%   #6: () required: node for vertical (y) placement
%   dibynnu ar (chronos main headings) a (chronos bottom)
%   \chronos@coords@completion{#3}{#4}%
  \coordinate (chronos@coord@temp) at ($(#4)!1/2!(#5)$);
  \IfValueTF {#3}{\def\chronos@tempa{#3}}{\edef\chronos@tempa{\chronos@testunteitl@priflythrennu{#2}}}%
  \node (#2) [anchor=base,#1] at (#6 -| chronos@coord@temp) {\chronos@tempa};
  \ifchronos@shownodes
    \begin{scope}[on chronos overlay layer]
      \draw [help lines, draw=chronos@lliw@node] (#2.north east) -| (#2.south west) -| cycle;
    \end{scope}%
  \fi
}

% BEGIN allweddau PGF/TikX
% BEGIN rhifau
\pgfkeys{/pgf/number format,
  int detect,
  set thousands separator={},
}
% END rhifau
% BEGIN layers / haenennau / haenau
\pgfqkeys{/chronos}{%
  declare layer/.code={%\DeclareDocumentCommand
    \pgfdeclarelayer{chronos #1}%
  },
  declare layer/.list={background,middle ground,foreground,overlay},
}
\IfFileExists{tikzlibrarycfrforeground.code.tex}{%
  \def\chronos@layers{background,chronos background,chronos middle ground,main,chronos foreground,chronos overlay,foreground}%
}{%
  \def\chronos@layers{background,chronos background,chronos middle ground,main,chronos foreground,chronos overlay}%
}
\pgfqkeys{/chronos}{%
  create layer/.code={%
    \tikzset{%
      % adapted from tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybackgrounds.code.tex
      on chronos #1 layer/.style={%
        execute at begin scope={%
          \pgfonlayer{chronos #1}%
          \let\tikz@options=\pgfutil@empty%
          \tikzset{every on chronos #1 layer/.try,##1}%
          \tikz@options%
        },
        execute at end scope={\endpgfonlayer}
      },
    }%
  },
  create layer/.list={background,middle ground,foreground,overlay},
}
% END layers / haenennau / haenau
% BEGIN ychwanegu i siap rectangle
% ateb Symbol 1: https://tex.stackexchange.com/a/385953/
\def\pgf@sm@shape@name{rectangle}
\pgf@sh@savedanchor\middlenortheast{%
  \pgf@x=\the\wd\pgfnodeparttextbox%
  \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}\advance\pgf@x by 2\pgf@xc%
  \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}\ifdim\pgf@x<\pgf@xb\pgf@x=\pgf@xb\fi%
  \pgf@x=.5\pgf@x\advance\pgf@x by.5\wd\pgfnodeparttextbox%
  \pgf@y=\ht\pgfnodeparttextbox\advance\pgf@y by\dp\pgfnodeparttextbox%
  \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}\advance\pgf@y by 2\pgf@yc%
  \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}\ifdim\pgf@y<\pgf@yb\pgf@y=\pgf@yb\fi%
  \pgf@y=.5\pgf@y\advance\pgf@y by-.5\dp\pgfnodeparttextbox\advance\pgf@y by.5\ht\pgfnodeparttextbox%
}
\pgf@sh@savedanchor\middlesouthwest{%
  \pgf@x=\wd\pgfnodeparttextbox%
  \pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}\advance\pgf@x by 2\pgf@xc%
  \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}\ifdim\pgf@x<\pgf@xb\pgf@x=\pgf@xb\fi%
  \pgf@x=-.5\pgf@x\advance\pgf@x by.5\wd\pgfnodeparttextbox%
  \pgf@y=\ht\pgfnodeparttextbox\advance\pgf@y by\dp\pgfnodeparttextbox%
  \pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}\advance\pgf@y by 2\pgf@yc%
  \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}\ifdim\pgf@y<\pgf@yb\pgf@y=\pgf@yb\fi%
  \pgf@y=-.5\pgf@y\advance\pgf@y by-.5\dp\pgfnodeparttextbox\advance\pgf@y by.5\ht\pgfnodeparttextbox%
}
\pgf@sh@anchor{middle north east}{\middlenortheast}
\pgf@sh@anchor{middle south west}{\middlesouthwest}
\pgf@sh@anchor{middle south east}{\middlenortheast\pgf@xa=\pgf@x\middlesouthwest\pgf@x=\pgf@xa}
\pgf@sh@anchor{middle north west}{\middlesouthwest\pgf@xa=\pgf@x\middlenortheast\pgf@x=\pgf@xa}
\pgf@sh@anchor{middle north}{%
  \pgf@process{\middlesouthwest}\pgf@xa=.5\pgf@x\pgf@process{\middlenortheast}\pgf@x=.5\pgf@x\advance\pgf@x by \pgf@xa
}
\pgf@sh@anchor{middle south}{%
  \pgf@process{\middlenortheast}\pgf@xa=.5\pgf@x\pgf@process{\middlesouthwest}\pgf@x=.5\pgf@x\advance\pgf@x by \pgf@xa
}
\pgf@sh@anchor{middle west}{%
  \pgf@process{\middlenortheast}\pgf@ya=.5\pgf@y\pgf@process{\middlesouthwest}\pgf@y=.5\pgf@y\advance\pgf@y by \pgf@ya
}
\pgf@sh@anchor{middle east}{%
  \pgf@process{\middlesouthwest}\pgf@ya=.5\pgf@y\pgf@process{\middlenortheast}\pgf@y=.5\pgf@y\advance\pgf@y by \pgf@ya
}
\pgf@sh@anchorborder{%
  \pgf@xb=\pgf@x\pgf@yb=\pgf@y\ifchronos@middleanchorborder\middlesouthwest\else\southwest\fi%
  \pgf@xa=\pgf@x\pgf@ya=\pgf@y\ifchronos@middleanchorborder\middlenortheast\else\northeast\fi%
  \advance\pgf@x by-\pgf@xa\advance\pgf@y by-\pgf@ya\pgf@xc=.5\pgf@x\pgf@yc=.5\pgf@y%
  \advance\pgf@xa by\pgf@xc\advance\pgf@ya by\pgf@yc%
  \edef\pgf@marshal{\noexpand\pgfpointborderrectangle
    {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}}%
  \pgf@process{\pgf@marshal}\advance\pgf@x by\pgf@xa\advance\pgf@y by\pgf@ya%
}
\tikzset{%
  /chronos/middle anchorborder/.is if=chronos@middleanchorborder,
}
% END ychwanegu i siap rectangle
% BEGIN \tikzset helpers
\NewDocumentCommand \chronos@cyd@destun@init { s t {+} o m m } {% chronos context initialisation
%   #1: peidiwch â gosod nodweddion o clists? | don't install properties from clists?
%   #2: setup dyddiadau? | dates?
%   #3: alt. path for filtering
%   #4: path & default path for filtering
%   #5: keys to process
  \renewcommand* \chronos@ychwanegu@nodweddion [3]{\relax}%
  \renewcommand* \chronos@ychwanegu@nodweddion@rhag [2]{\relax}%
  \renewcommand* \chronos@cadw@nodweddion [3]{\relax}%
  \renewcommand* \chronos@cadw@nodweddion@rhag [2]{\relax}%
  \IfBooleanT {#2} {%
    \pgfqkeys{/chronos}{% paid ag ychwanegu i property lists rhagosodedig mewn cyd-destun lleoll
      % don't add to default property lists in a local context
      blynyddoedd yn unig/.code={%
        \chronos@dimondblynyddoeddtrue
        \ifchronos@dangoscyfnodau
          \pgfqkeys{/chronos/#4/dangos cyfnodau}{@blynyddoedd yn unig}%
        \else
          \pgfqkeys{/chronos/#4/heb gyfnodau}{@blynyddoedd yn unig}%
        \fi
      },
      dyddiadau llawn/.code={%
        \chronos@dimondblynyddoeddfalse
        \ifchronos@dangoscyfnodau
          \pgfqkeys{/chronos/#4/dangos cyfnodau}{@llawn}%
        \else
          \pgfqkeys{/chronos/#4/heb gyfnodau}{@llawn}%
        \fi
      },
      dangos cyfnodau/.code={%
        \chronos@dangoscyfnodautrue
        \ifchronos@dimondblynyddoedd
          \pgfqkeys{/chronos/#4/dangos cyfnodau}{@blynyddoedd yn unig}%
        \else
          \pgfqkeys{/chronos/#4/dangos cyfnodau}{@llawn}%
        \fi
      },
      heb gyfnodau/.code={%
        \chronos@dangoscyfnodaufalse
        \ifchronos@dimondblynyddoedd
          \pgfqkeys{/chronos/#4/heb gyfnodau}{@blynyddoedd yn unig}%
        \else
          \pgfqkeys{/chronos/#4/heb gyfnodau}{@llawn}%
        \fi
      },
    }%
  }%
  \pgfqkeys{/chronos}{% paid ag ychwanegu i property lists rhagosodedig mewn cyd-destun lleoll | ditto
    tags/.code={\pgfqkeys{/chronos}{@tag/.style={##1}}},
    tags+/.code={\pgfqkeys{/chronos}{@tag/.append style={##1}}},
    testunau/.code={\pgfqkeys{/chronos}{@testun/.style={##1}}},
    testunau+/.code={\pgfqkeys{/chronos}{@testun/.append style={##1}}},
    cysylltiadau/.code={\pgfqkeys{/chronos}{@cysylltiad/.style={##1}}},
    cysylltiadau+/.code={\pgfqkeys{/chronos}{@cysylltiad/.append style={##1}}},
    cysylltwyr chronos'/.code={\pgfqkeys{/chronos}{@cysylltwr@chronos/.style={##1}}},
    cysylltwyr chronos+/.code={\pgfqkeys{/chronos}{@cysylltwr@chronos/.append style={##1}}},
    cysylltwyr testun'/.code={\pgfqkeys{/chronos}{@cysylltwr@testun/.style={##1}}},
    cysylltwyr testun+/.code={\pgfqkeys{/chronos}{@cysylltwr@testun/.append style={##1}}},
    prif gysylltwyr testun'/.code={\pgfqkeys{/chronos}{@cysylltwr@testun@prif/.style={##1}}},
    prif gysylltwyr testun+/.code={\pgfqkeys{/chronos}{@cysylltwr@testun@prif/.append style={##1}}},
    llinellau/.code={\pgfqkeys{/chronos}{@llinell/.style={##1}}},
    llinellau+/.code={\pgfqkeys{/chronos}{@llinell/.append style={##1}}},
    phantom/.is if=chronos@phantom,
    phantom/.default=true,
    troi lliwiau/.is if=chronos@troilliwiau,
    troi lliwiau/.default=true,
    testun yshift/.chronos dimen=\chronos@testun@yshift,
    #4/tag'/.code={\pgfqkeys{/chronos}{@tag/.style={##1}}},
    #4/testun'/.code={\pgfqkeys{/chronos}{@testun/.style={##1}}},
    #4/cysylltiad'/.code={\pgfqkeys{/chronos}{@cysylltiad/.style={##1}}},
    #4/llinell'/.code={\pgfqkeys{/chronos}{@llinell/.style={##1}}},
    #4/cysylltwr chronos'/.code={\pgfqkeys{/chronos}{@cysylltwr@chronos/.style={##1}}},
    #4/cysylltwr testun'/.code={\pgfqkeys{/chronos}{@cysylltwr@testun/.style={##1}}},
    #4/prif gysylltwr testun'/.code={\pgfqkeys{/chronos}{@cysylltwr@testun@prif/.style={##1}}},
    #4/tag+/.code={\pgfqkeys{/chronos}{@tag/.append style={##1}}},
    #4/testun+/.code={\pgfqkeys{/chronos}{@testun/.append style={##1}}},
    #4/cysylltiad+/.code={\pgfqkeys{/chronos}{@cysylltiad/.append style={##1}}},
    #4/llinell+/.code={\pgfqkeys{/chronos}{@llinell/.append style={##1}}},
    #4/cysylltwr chronos+/.code={\pgfqkeys{/chronos}{@cysylltwr@chronos/.append style={##1}}},
    #4/cysylltwr testun+/.code={\pgfqkeys{/chronos}{@cysylltwr@testun/.append style={##1}}},
    #4/prif gysylltwr testun+/.code={\pgfqkeys{/chronos}{@cysylltwr@testun@prif/.append style={##1}}},
    #4/blynyddoedd yn unig/.forward to=/chronos/blynyddoedd yn unig,
    #4/dyddiadau llawn/.forward to=/chronos/dyddiadau llawn,
    #4/dangos cyfnodau/.forward to=/chronos/dangos cyfnodau,
    #4/heb gyfnodau/.forward to=/chronos/heb gyfnodau,
    #4/testun yn unig/.forward to=/chronos/testun yn unig,
    #4/troi lliwiau/.is if=chronos@troilliwiau,
    #4/troi lliwiau/.default=true,
    #4/phantom/.is if=chronos@phantom,
    #4/phantom/.default=true,
    #4/testun yshift/.chronos dimen=\chronos@testun@yshift,
    #4/lliw rhagosodedig/.code={%
      \edef\tempa{\csname chronos@#4@lliw\endcsname}%
      \edef\tempb{\csname chronos@#4@lliw@rhagosodedig\endcsname}%
      \expandafter\let\tempa\tempb
    },
  }%
  \def\chronos@cadw{}% clirio'r macro
  \IfBooleanF {#1}{%
    \chronos@gosod@nodweddion{#4}%
  }%
  \pgfqkeys{/pgf}{%
    key filters/defined/.install key filter,
    key filter handlers/append filtered to/.install key filter handler=\chronos@cadw,
  }%
  \IfValueTF {#3}{% defnyddio'r allweddau sy'n diffinio | define defined keys
    \pgfkeysfiltered{/chronos/#3/.cd,/chronos/@tag,#5}% 
  }{%
    \pgfkeysfiltered{/chronos/#4/.cd,/chronos/@tag,#5}% 
  }%
%   \show\chronos@cadw
  \IfBooleanT {#2}{% set date formats, whether showing eras, whether using full dates
    \chronos@if@gosodF{@#4@fformatiau@dyddiadau}{%
      \ifchronos@dimondblynyddoedd
        \ifchronos@dangoscyfnodau
          \pgfqkeys{/chronos/#4/dangos cyfnodau}{@blynyddoedd yn unig}%
        \else
          \pgfqkeys{/chronos/#4/heb gyfnodau}{@blynyddoedd yn unig}%
        \fi
      \else
        \ifchronos@dangoscyfnodau
          \pgfqkeys{/chronos/#4/dangos cyfnodau}{@llawn}%
        \else
          \pgfqkeys{/chronos/#4/heb gyfnodau}{@llawn}%
        \fi
      \fi
    }%
  }%
}
% END \tikzset helpers
\tikzset{%
  % BEGIN handlers
  /handlers/.chronos dimen/.code={%
    \pgfkeysdef{\pgfkeyscurrentpath}{%
      \pgfmathparse{##1}%
      #1=\pgfmathresult pt
    }%
    \pgfkeysdef{\pgfkeyscurrentpath'}{#1=##1}%
    \pgfkeysdef{\pgfkeyscurrentpath'+}{\advance #1 by ##1}%
    \pgfkeysdef{\pgfkeyscurrentpath'-}{\advance #1 by -##1}%
    \pgfkeysdef{\pgfkeyscurrentpath+}{%
      \pgfmathparse{##1}%
      \advance #1 by \pgfmathresult pt
    }%
    \pgfkeysdef{\pgfkeyscurrentpath-}{%
      \pgfmathparse{##1}%
      \advance #1 by -\pgfmathresult pt
    }%
  },
  /handlers/.chronos 2 dimens/.code 2 args={%
    \pgfkeysdefargs{\pgfkeyscurrentpath}{##1:##2}{%
      \pgfmathparse{##1}%
      #1=\pgfmathresult pt
      \pgfmathparse{##2}%
      #2=\pgfmathresult pt
    }%
    \pgfkeysdefargs{\pgfkeyscurrentpath'}{##1:##2}{%
      #1=##1 
      #2=##2
    }%
    \pgfkeysdefargs{\pgfkeyscurrentpath'+}{##1:##2}{%
      \advance #1 by ##1
      \advance #2 by ##2
    }%
    \pgfkeysdefargs{\pgfkeyscurrentpath'-}{##1:##2}{%
      \advance #1 by -##1
      \advance #2 by -##2
    }%
    \pgfkeysdefargs{\pgfkeyscurrentpath+}{##1:##2}{%
      \pgfmathparse{##1}\advance #1 by \pgfmathresult pt
      \pgfmathparse{##2}\advance #2 by \pgfmathresult pt
    }%
    \pgfkeysdefargs{\pgfkeyscurrentpath-}{##1:##2}{%
      \pgfmathparse{##1}\advance #1 by -\pgfmathresult pt
      \pgfmathparse{##2}\advance #2 by -\pgfmathresult pt
    }%
  },
  /handlers/.chronos layer choice/.code={%
    % \chronos@ychwanegu@gosod tracks the setting so if a user sets the layer explicitly, chronos won't override it
    \edef\chronos@temppgfpath{\pgfkeyscurrentpath}%
    \pgfkeys{% set the layer to put all things of some kind on e.g. connections, lines, timeline border
      \pgfkeyscurrentpath/.is choice,
      \chronos@temppgfpath/.cd,
      background/.code={\pgfkeys{/chronos/chronos@#1@haenen/.style={on chronos background layer}}\chronos@ychwanegu@gosod{#1}},
      middle ground/.code={\pgfkeys{/chronos/chronos@#1@haenen/.style={on chronos middle ground layer}}\chronos@ychwanegu@gosod{#1}},
      foreground/.code={\pgfkeys{/chronos/chronos@#1@haenen/.style={on chronos foreground layer}}\chronos@ychwanegu@gosod{#1}},
      overlay/.code={\pgfkeys{/chronos/chronos@#1@haenen/.style=on chronos overlay layer}\chronos@ychwanegu@gosod{#1}},
      main/.code={\pgfkeys{/chronos/chronos@#1@haenen/.style={}}\chronos@ychwanegu@gosod{#1}},
    }%
  },
  /handlers/.chronos lliw/.code={% chronos colour
    \pgfkeysdef{\pgfkeyscurrentpath}{\colorlet{chronos@#1}{##1}}%
  },
  /handlers/.chronos track/.code={% track setting of property by user
    \pgfkeys{%
      \pgfkeyscurrentpath/.append code={\chronos@ychwanegu@gosod{#1}},
    }%
  },
  /handlers/.chronos search/.code={% set up search so english paths work e.g. /chronos/life
    \pgfkeys{%
      \pgfkeyscurrentpath/.unknown/.code={%
        \let\searchname=\pgfkeyscurrentname%
        \pgfkeysalso{% **angen** y {} o gwmpas ##1 isod! | **need** the {} around ##1 below!
          /chronos/#1/\searchname/.try={##1},
          /chronos/\searchname/.retry={##1},
          /tikz/\searchname/.retry={##1},
          /pgf/\searchname/.lastretry={##1}%
        }%
      },
    }%
  },
  % BEGIN /handlers/.chronos tag init
  /handlers/.chronos tag init/.code 2 args={% initialise a chronos 'tag' e.g. life, event, period
    \pgfkeys{%
      \pgfkeyscurrentpath/.cd,
      % english translations below
      enw/.store in/.expand once=\csname chronos@#1@enw\endcsname,
      % create a tikz-friendly version of name, in case name contains anything problematic
      chronos@tikzname/.code={\chronos@creu@tikzname {#1}{##1}},
      enw/.forward to=/chronos/#1/chronos@tikzname,
      fel y mae/.is if=chronos@felymae,
      fel y mae/.default=true,
      llinell'/.code={\chronos@cadw@nodweddion{#1}{@llinell}{##1}},
      llinell+/.code={\chronos@ychwanegu@nodweddion{#1}{@llinell}{##1}},
      llinell/.forward to=/chronos/#1/llinell',
      %   llinell={fill=##1},
      lliw/.store in/.expand once=\csname chronos@#1@lliw\endcsname,
      %   lliw/.chronos tag lliw={#1}{lliw},
      lliw rhagosodedig/.store in/.expand once=\csname chronos@#1@lliw@rhagosodedig\endcsname,
      lliw rhagosodedig=chronos@prifliw,
      lliwiau uchod/.code={\chronos@lliwiau@uchod[#1]{##1}},
      lliwiau isod/.code={\chronos@lliwiau@isod[#1]{##1}},
      lliwiau uchod o clist/.code={\chronos@global@eq@clist{lliwiau_#1_uchod}{##1}},
      lliwiau isod o clist/.code={\chronos@global@eq@clist{lliwiau_#1_isod}{##1}},
      isod/.is if=chronos@#1@isod,
      uchod/.code/.expand once={\csname chronos@#1@isodfalse\endcsname},
      at/.store in/.expand once=\csname chronos@#1@at\endcsname,
      at/.expand once=\csname chronos@#1@tikzname\endcsname,
      angor/.store in/.expand once=\csname chronos@#1@angor\endcsname,
      angor/.forward to=/tikz/anchor,
      cysylltu/.is if=chronos@#1@cysylltiad,
      cysylltiad'/.code={\chronos@cadw@nodweddion{#1}{@cysylltiad}{##1}},
      cysylltiad+/.code={\chronos@ychwanegu@nodweddion{#1}{@cysylltiad}{##1}},
      cysylltiad/.forward to=/chronos/#1/cysylltiad',
%       cysylltiad={draw=##1},
      cysylltwr chronos'/.code={\chronos@cadw@nodweddion{#1}{@cysylltwr@chronos}{##1}},
      cysylltwr chronos+/.code={\chronos@ychwanegu@nodweddion{#1}{@cysylltwr@chronos}{##1}},
      cysylltwr chronos/.forward to=/chronos/#1/cysylltwr chronos+,
      cysylltwr testun'/.code={\chronos@cadw@nodweddion{#1}{@cysylltwr@testun}{##1}},
      cysylltwr testun+/.code={\chronos@ychwanegu@nodweddion{#1}{@cysylltwr@testun}{##1}},
      cysylltwr testun/.forward to=/chronos/#1/cysylltwr testun+,
      ffont testun/.code={\expandafter\def\csname chronos@#1@ffonttestun\endcsname{##1}},
      ffont testun=,
      prif gysylltwr testun'/.code={\chronos@cadw@nodweddion{#1}{@cysylltwr@testun@prif}{##1}},
      prif gysylltwr testun+/.code={\chronos@ychwanegu@nodweddion{#1}{@cysylltwr@testun@prif}{##1}},
      prif gysylltwr testun/.forward to=/chronos/#1/prif gysylltwr testun',
      tag'/.code={\chronos@cadw@nodweddion{#1}{@tag}{##1}},
      tag+/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{##1}},
      tag/.forward to=/chronos/#1/tag+,
      testun'/.code={\chronos@cadw@nodweddion{#1}{@testun}{##1}},
      testun+/.code={\chronos@ychwanegu@nodweddion{#1}{@testun}{##1}},
      testun/.forward to=/chronos/#1/testun',
      cysylltwyr+/.code={% rhan o /chronos/#1; paid â ddileu fe!! | part of /chronos/#1; don't delete it!!
        \csname chronos@#1@cysylltiadtheoritrue\endcsname
        \IfExistTF \chronos@cysylltwyr {%
          \expandafter\def\expandafter\chronos@cysylltwyr\expandafter{\chronos@cysylltwyr,##1}%
        }{\def \chronos@cysylltwyr{##1}}%
      },
      cysylltwyr'/.code={%
        \csname chronos@#1@cysylltiadtheoritrue\endcsname
        \def \chronos@cysylltwyr{##1}%
      },
      cysylltwyr/.forward to=/chronos/#1/cysylltwyr+,
      testun yn unig/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yn unig}},
      troi lliwiau/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/troi lliwiau=##1}},
      troi lliwiau/.default=true,
      phantom/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/phantom=##1}},
      phantom/.default=true,
      cynnwys testun/.store in=\chronos@cynnwys@testun,
      cynnwys enw/.store in=\chronos@cynnwys@enw,
      cynnwys dyddiadau/.store in=\chronos@cynnwys@dyddiadau,
      yshift/.store in=\chronos@yshift,
      yshift/.forward to=yshift,
      testun yshift/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift=##1}},
      testun yshift'/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift'=##1}},
      testun yshift+/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift+=##1}},
      testun yshift-/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift-=##1}},
      testun yshift'+/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift'+=##1}},
      testun yshift'-/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/testun yshift'-=##1}},
      % BEGIN saesneg: /chronos/#1
%       /chronos/#2/.cd,% yn anffodus dyw hyn ddim yn gweithio (not forwarded on pellach)
      name/.forward to=/chronos/#1/enw,
%       at/.forward to=/chronos/#1/at, % paid â gwneud hwn! vicious circularity -> TeX capacity exceeded!!
      as is/.forward to=/chronos/#1/fel y mae,
      colour/.forward to=/chronos/#1/lliw,
      color/.forward to=/chronos/#1/lliw,
      default colour/.forward to=/chronos/#1/lliw rhagosodedig,
      default color/.forward to=/chronos/#1/lliw rhagosodedig,
      colours above/.forward to=/chronos/#1/lliwiau uchod,
      colours below/.forward to=/chronos/#1/lliwiau isod,
      colors above/.forward to=/chronos/#1/lliwiau uchod,
      colors below/.forward to=/chronos/#1/lliwiau isod,
      colours above from clist/.forward to=/chronos/#1/lliwiau uchod o clist,
      colours below from clist/.forward to=/chronos/#1/lliwiau isod o clist,
      colors above from clist/.forward to=/chronos/#1/lliwiau uchod o clist,
      colors below from clist/.forward to=/chronos/#1/lliwiau isod o clist,
      place below/.forward to=/chronos/#1/isod,
      place above/.forward to=/chronos/#1/uchod,
      tag anchor/.forward to=/chronos/#1/angor,
      connect/.forward to=/chronos/#1/cysylltu,
      connection/.forward to=/chronos/#1/cysylltiad,
      connection'/.forward to=/chronos/#1/cysylltiad',
      connection+/.forward to=/chronos/#1/cysylltiad+,
      connectors/.forward to=/chronos/#1/cysylltwyr,
      connectors+/.forward to=/chronos/#1/cysylltwyr+,
      connectors'/.forward to=/chronos/#1/cysylltwyr',
      text font/.forward to=/chronos/#1/ffont testun,
      text tag connector+/.forward to=/chronos/#1/cysylltwr testun+,
      text tag connector'/.forward to=/chronos/#1/cysylltwr testun',
      text tag connector/.forward to=/chronos/#1/cysylltwr testun,
      main text tag connector+/.forward to=/chronos/#1/prif gysylltwr testun+,
      main text tag connector'/.forward to=/chronos/#1/prif gysylltwr testun',
      main text tag connector/.forward to=/chronos/#1/prif gysylltwr testun,
      chronos connector+/.forward to=/chronos/#1/cysylltwr chronos+,
      chronos connector'/.forward to=/chronos/#1/cysylltwr chronos',
      chronos connector/.forward to=/chronos/#1/cysylltwr chronos,
      colour rotation/.forward to=/chronos/#1/troi lliwiau,
      color rotation/.forward to=/chronos/#1/troi lliwiau,
      line/.forward to=/chronos/#1/llinell,
      line'/.forward to=/chronos/#1/llinell',
      line+/.forward to=/chronos/#1/llinell+,
      only text/.forward to=/chronos/#1/testun yn unig,
      text tag/.forward to=/chronos/#1/testun,
      text tag'/.forward to=/chronos/#1/testun',
      text tag+/.forward to=/chronos/#1/testun+,
      text tag yshift/.forward to=/chronos/#1/testun yshift,
      text tag yshift'/.forward to=/chronos/#1/testun yshift',
      text tag yshift+/.forward to=/chronos/#1/testun yshift+,
      text tag yshift-/.forward to=/chronos/#1/testun yshift-,
      text tag yshift'+/.forward to=/chronos/#1/testun yshift'+,
      text tag yshift'-/.forward to=/chronos/#1/testun yshift'-,
      text content/.forward to=/chronos/#1/cynnwys testun,
      name content/.forward to=/chronos/#1/cynnwys enw,
      dates content/.forward to=/chronos/#1/cynnwys dyddiadau,
%       yshift/.forward to=/chronos/#1/yshift, % paid â gwneud hwn! vicious circularity -> TeX capacity exceeded!!
%       tag/.forward to=/chronos/#1/tag, % paid â gwneud hwn! vicious circularity -> TeX capacity exceeded!!
%       tag+/.forward to=/chronos/#1/tag+, % paid â gwneud hwn! vicious circularity -> TeX capacity exceeded!!
      % END saesneg: /chronos/#1
      % BEGIN shortcuts
      /chronos/.cd,
      cysylltiad #1+/.forward to=/chronos/#1/cysylltiad+,
      cysylltiad #1'/.forward to=/chronos/#1/cysylltiad',
      cysylltiad #1/.forward to=/chronos/#1/cysylltiad,
      cysylltwr chronos #1+/.forward to=/chronos/#1/cysylltwr chronos+,
      cysylltwr chronos #1'/.forward to=/chronos/#1/cysylltwr chronos',
      cysylltwr chronos #1/.forward to=/chronos/#1/cysylltwr chronos,
      cysylltwr testun #1+/.forward to=/chronos/#1/cysylltwr testun+,
      cysylltwr testun #1'/.forward to=/chronos/#1/cysylltwr testun',
      cysylltwr testun #1/.forward to=/chronos/#1/cysylltwr testun,
      prif gysylltwr testun #1+/.forward to=/chronos/#1/prif gysylltwr testun+,
      prif gysylltwr testun #1'/.forward to=/chronos/#1/prif gysylltwr testun',
      prif gysylltwr testun #1/.forward to=/chronos/#1/prif gysylltwr testun,
      llinell #1+/.forward to=/chronos/#1/llinell+,
      llinell #1'/.forward to=/chronos/#1/llinell',
      llinell #1/.forward to=/chronos/#1/llinell,
      testun #1+/.forward to=/chronos/#1/testun+,
      testun #1'/.forward to=/chronos/#1/testun',
      testun #1/.forward to=/chronos/#1/testun,
      % BEGIN saesneg
      #2 connection+/.forward to=/chronos/#1/cysylltiad+,
      #2 connection'/.forward to=/chronos/#1/cysylltiad',
      #2 connection/.forward to=/chronos/#1/cysylltiad,
      #2 chronos connector+/.forward to=/chronos/#1/cysylltwr chronos+,
      #2 chronos connector'/.forward to=/chronos/#1/cysylltwr chronos',
      #2 chronos connector/.forward to=/chronos/#1/cysylltwr chronos,
      #2 text tag connector+/.forward to=/chronos/#1/cysylltwr testun+,
      #2 text tag connector'/.forward to=/chronos/#1/cysylltwr testun',
      #2 text tag connector/.forward to=/chronos/#1/cysylltwr testun,
      #2 main text tag connector+/.forward to=/chronos/#1/prif gysylltwr testun+,
      #2 main text tag connector'/.forward to=/chronos/#1/prif gysylltwr testun',
      #2 main text tag connector/.forward to=/chronos/#1/prif gysylltwr testun,
      #2 line+/.forward to=/chronos/#1/llinell+,
      #2 line'/.forward to=/chronos/#1/llinell',
      #2 line/.forward to=/chronos/#1/llinell,
      #2 text tag+/.forward to=/chronos/#1/testun+,
      #2 text tag'/.forward to=/chronos/#1/testun',
      #2 text tag/.forward to=/chronos/#1/testun,      
      % END saesneg
      % END shortcuts
      /chronos/#2/.chronos search=#1,
      /chronos/#1/.chronos search=#2,% heb bwrpas | pointless
      /chronos/#1/.code={\pgfqkeys{/chronos/#1}{##1}},
      /chronos/#2/.forward to=/chronos/#1,
    }%
  },
  % END .chronos tag init
  % BEGIN /handlers/.chronos tag dyddiadau init
  /handlers/.chronos tag dyddiadau init/.code args={#1:#2:#3:#4:#5:#6:#7:#8:#9}{% e.g. /chronos/byw/.chronos tag dyddiadau init=byw:geni:marw:bu farw:bufarw:geni:marw:birth:death
    % for elements belonging to tags of types which span more than one date e.g. life, period
    % we need 3 date formats (possibly all the same)
    % the first is for the begin date when both dates belong to the same era
    % the second is for the begin date when the eras differ
    % the third is for the end date (regardless)
    \pgfkeys{\pgfkeyscurrentpath/.cd,
      dyddiadau/.code args={##1:##2}{% angen y llinell nesaf am y saesneg yn unig
        \pgfqkeys{/chronos/#1}{#2=##1}% needed only for the english ?? (why?)
        \edef\tempa{##2}\edef\tempb{}\ifx\tempa\tempb\else\pgfqkeys{/chronos/#1}{#3=##2}\fi
      },
      #4/.is if=chronos@#5,
      % paid â cheisio ddefnyddio macros yn lle allweddau yn y fan hon 
      % don't try to use macros instead of keys here
%       #2/.code={\chronos@set@date@aux{##1-01-01-0@#6}},
%       #3/.code={\chronos@set@date@aux{##1-12-31-0@#7}\chronos@legacy@if@set{#5}{true}},
      #2/.style={/chronos/set date aux/.expanded={##1-01-01-0@#6}},
      #3/.style={/chronos/set date aux/.expanded={##1-12-31-0@#7},/chronos/#1/#4=true},     
      #3={\year-\month-\day},
      label #2/.store in/.expand once=\csname chronos@#1@label#2\endcsname,
      label #3/.store in/.expand once=\csname chronos@#1@label#3\endcsname,
      fformatiau dyddiadau/.style args={##1:##2:##3}{%
        /chronos/#1/fformat #2 yr un gyfnod={##1},
        /chronos/#1/fformat #2 cyfnodau gwahanol={##2},
        /chronos/#1/fformat #3={##3},
      },
      fformatiau dyddiadau/.chronos track={@#1@fformatiau@dyddiadau,@#1@cyfnodau,@#1@llawn},
      fformat #2 yr un gyfnod/.code={%
        \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{##1}%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/#1/fformat #2 yr un gyfnod={##1}}%
      },
      fformat #2 cyfnodau gwahanol/.code={%
        \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{##1}%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/#1/fformat #2 cyfnodau gwahanol={##1}}%
      },
      fformat #2/.forward to=/chronos/#1/fformat #2 yr un gyfnod,
      fformat #2/.forward to=/chronos/#1/fformat #2 cyfnodau gwahanol,
      fformat #3/.code={%
        \expandafter\def\csname chronos@#1@fformat#3\endcsname{##1}%
        \chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/#1/fformat #3={##1}}%
      },
      fformat #2 yr un gyfnod/.chronos track={@#1@fformatiau@dyddiadau,@#1@cyfnodau,@#1@llawn},
      fformat #2 cyfnodau gwahanol/.chronos track={@#1@fformatiau@dyddiadau,@#1@cyfnodau,@#1@llawn},
      fformat #2/.chronos track={@#1@fformatiau@dyddiadau,@#1@cyfnodau,@#1@llawn},
      fformat #3/.chronos track={@#1@fformatiau@dyddiadau,@#1@cyfnodau,@#1@llawn},
      dangos cyfnodau/@blynyddoedd yn unig/.code={% show eras + only years formats
        \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{!Y}%
        \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{!Y\thinspace !E}%
        \expandafter\def\csname chronos@#1@fformat#3\endcsname{!Y\thinspace !E}%
      },
      dangos cyfnodau/@llawn/.code={% show eras + full dates formats
        \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{!d/!m/!Y}%
        \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{!d/!m/!Y\thinspace !E}%
        \expandafter\def\csname chronos@#1@fformat#3\endcsname{!d/!m/!Y\thinspace !E}%
      },
      dangos cyfnodau/llawn/.code n args=3{% show eras + full dates set formats
        \pgfqkeys{/chronos/#1/dangos cyfnodau}{%
          @llawn/.code={%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{##1}%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{##2}%
            \expandafter\def\csname chronos@#1@fformat#3\endcsname{##3}%
          }%
        }%
      },
      dangos cyfnodau/blynyddoedd yn unig/.code n args=3{% show eras + only years set formats
        \pgfqkeys{/chronos/#1/dangos cyfnodau}{%
          @blynyddoedd yn unig/.code={%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{##1}%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{##2}%
            \expandafter\def\csname chronos@#1@fformat#3\endcsname{##3}%
          }%
        }%
      },
      heb gyfnodau/@blynyddoedd yn unig/.code={% w/o eras + only years formats
            \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{!Y}%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{!Y}%
            \expandafter\def\csname chronos@#1@fformat#3\endcsname{!Y}%
      },
      heb gyfnodau/@llawn/.code={% w/o eras + full dates formats
        \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{!d/!m/!Y}%
        \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{!d/!m/!Y}%
        \expandafter\def\csname chronos@#1@fformat#3\endcsname{!d/!m/!Y}%
      },
      heb gyfnodau/llawn/.code n args=3{% w/o eras + full dates set formats
        \pgfqkeys{/chronos/#1/heb gyfnodau}{%
          @llawn/.code={%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{##1}%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{##2}%
            \expandafter\def\csname chronos@#1@fformat#3\endcsname{##3}%
          }%
        }%
      },
      heb gyfnodau/blynyddoedd yn unig/.code n args=3{% w/o eras + only years set formats
        \pgfqkeys{/chronos/#1/heb gyfnodau}{%
          @blynyddoedd yn unig/.code={%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnod\endcsname{##1}%
            \expandafter\def\csname chronos@#1@fformat#2@cyfnodau\endcsname{##2}%
            \expandafter\def\csname chronos@#1@fformat#3\endcsname{##3}%
          }%
        }%
      },
      % english translations below
      blynyddoedd yn unig/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/blynyddoedd yn unig}},
      dyddiadau llawn/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/dyddiadau llawn}},
      dangos cyfnodau/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/dangos cyfnodau}},
      heb gyfnodau/.code={\chronos@ychwanegu@nodweddion{#1}{@tag}{/chronos/heb gyfnodau}},
      dangos cyfnodau/.chronos track={@#1@cyfnodau},
      dyddiadau llawn/.chronos track={@#1@llawn},
      heb gyfnodau/.chronos track={@#1@cyfnodau},
      blynyddoedd yn unig/.chronos track={@#1@llawn},
      ffont dyddiad/.code={\expandafter\def\csname chronos@#1@ffontdyddiad\endcsname{##1}},
      ffont dyddiad=,
      % BEGIN saesneg: /chronos/#1
      dates/.forward to=/chronos/#1/dyddiadau,
      #8/.forward to=/chronos/#1/#2,
      #9/.forward to=/chronos/#1/#3,
      date formats/.forward to=/chronos/#1/fformatiau dyddiadau,
      #8 format/.forward to=/chronos/#1/fformat #2,
      same era #8 format/.forward to=/chronos/#1/fformat #2 yr un gyfnod,
      different eras #8 format/.forward to=/chronos/#1/fformat #2 cyfnodau gwahanol,
      #9 format/.forward to=/chronos/#1/fformat #3,
      show eras/full/.forward to=/chronos/#1/dangos cyfnodau/llawn,
      show eras/only years/.forward to=/chronos/#1/dangos cyfnodau/blynyddoedd yn unig,
      without eras/full/.forward to=/chronos/#1/heb gyfnodau/llawn,
      without eras/only years/.forward to=/chronos/#1/heb gyfnodau/blynyddoedd yn unig,
      #8 label/.forward to=/chronos/#1/label #2,
      #9 label/.forward to=/chronos/#1/label #3,
      only years/.forward to=/chronos/#1/blynyddoedd yn unig,
      full dates/.forward to=/chronos/#1/dyddiadau llawn,
      without eras/.forward to=/chronos/#1/heb gyfnodau,
      show eras/.forward to=/chronos/#1/dangos cyfnodau,
      date font/.forward to=/chronos/#1/ffont dyddiad,
      % END saesneg: /chronos/#1
    }%
  },
  % END .chronos tag dyddiadau init
  /handlers/.chronos key maker/.code n args=3{%
    \chronos@keymaker{#1}{#2}{#3}%
  },
  % END handlers
  % BEGIN chronos (prif gôd)
  chronos/.code={\PackageError{chronos}{%
    The key chronos is deprecated.\MessageBreak
    Use the environment chronos instead.}},
  % END chronos (prif gôd)
  % BEGIN byw | life (prif gôd)
  byw/.code={\chronos@cyd@destun@init+{byw}{#1}},
  byw/.default={},
  % END byw (prif gôd)
  % BEGIN digwyddiad | event (prif gôd)
  digwyddiad/.code={\chronos@cyd@destun@init+{digwyddiad}{#1}},
  digwyddiad/.default={},
  % END digwyddiad (prif gôd)
  % BEGIN parhad | period (prif gôd)
  parhad/.code={\chronos@cyd@destun@init+{parhad}{#1}},
  parhad/.default={},
  % END parhad (prif gôd)
  % BEGIN theori | theory (prif gôd)
  theori/.code={\chronos@cyd@destun@init{theori}{#1}\chronos@tag@cysylltufalse},
  theori/.default={},
  % END theori (prif gôd)
  % BEGIN cylch theori | theory circle (prif gôd) --- cylchau bychain heb gysylltiadau
  cylch theori/.code={\chronos@cyd@destun@init[theori/cylchau]{theori}{#1}\chronos@tag@cysylltufalse},
  cylch theori/.default={},
  % END cylch theori (prif gôd)
  % BEGIN gwybodaeth | info (prif gôd)
  gwybodaeth/.code={\chronos@cyd@destun@init{gwybodaeth}{#1}\chronos@tag@cysylltufalse},
  gwybodaeth/.default={},
  % END gwybodaeth (prif gôd)
  % BEGIN prif (teitl) main (title) (prif gôd) 
  prif/.code={\chronos@cyd@destun@init*{prif}{#1}},
  prif/.default={},
  % END prif (teitl) (prif gôd)
  % BEGIN hawlfraint copyright (prif gôd) 
  hawlfraint/.code={\chronos@cyd@destun@init*{hawlfraint}{#1}},
  hawlfraint/.default={},
  % END hawlfraint copyright (prif gôd)
  % BEGIN saesneg byw digwyddiad parhad theori cylch theori prif
  life/.forward to=/tikz/byw,
  event/.forward to=/tikz/digwyddiad,
  period/.forward to=/tikz/parhad,
  theory/.forward to=/tikz/theori,
  theory circle/.forward to=/tikz/cylch theori,
  main/.forward to=/tikz/prif,
  copyright/.forward to=/tikz/hawlfraint,
  copyleft/.forward to=/tikz/hawlfraint,
  % END saesneg byw digwyddiad parhad theori cylch theori prif
  % BEGIN top-level styles
  chronos connect/.style args={#1:#2}{#1,/chronos/@cysylltiad=lliw #2},
  chronos create chronos connector/.style args={#1:#2}{#1,/chronos/@cysylltwr@chronos=lliw #2},
  chronos create text tag connector/.style args={#1:#2}{#1,/chronos/@cysylltwr@testun=lliw #2},
  chronos mark line/.style args={#1:#2}{#1,/chronos/@llinell=lliw #2},
  chronos text tag/.style args={#1:#2}{#1,/chronos/@testun=lliw #2},
  chronos tikz'/.code={\pgfkeysdef{/chronos/@tikz}{#1}},
  chronos tikz+/.code={\pgfqkeys{/chronos}{@tikz/.append code={#1}}},
  chronos tikz/.forward to=/chronos tikz+,
  chronos tikz outside bb'/.code={\pgfkeysdef{/chronos/@@tikz}{#1}},
  chronos tikz outside bb+/.code={\pgfqkeys{/chronos}{@@tikz/.append code={#1}}},
  chronos tikz outside bb/.forward to=/chronos tikz outside bb+,
  % END top-level styles
  % BEGIN llwybrau: /chronos /chronos/byw /chronos/digwyddiad /chronos/theori
  /chronos/.search also={/chronos/llinell amser,/tikz,/pgf},
  /chronos/llinell amser/.search also={/chronos,/tikz,/pgf},
  /chronos/byw/.search also={/chronos,/tikz,/pgf},
  /chronos/digwyddiad/.search also={/chronos,/tikz,/pgf},
  /chronos/parhad/.search also={/chronos,/tikz,/pgf},
  /chronos/theori/.search also={/chronos,/tikz,/pgf},
  /chronos/theori/cylchau/.search also={/chronos/theori,/chronos,/tikz,/pgf},
  % END llwybrau: /chronos /chronos/byw /chronos/digwyddiad /chronos/theori
  % BEGIN /chronos
  /chronos/.cd,
  @before@headings/.code={},
  before headings+/.code={\pgfqkeys{/chronos}{@before@headings/.append code={#1}}},
  before headings'/.code={\pgfqkeys{/chronos}{@before@headings/.code={#1}}},
  before headings/.forward to=/chronos/before headings+,
  @before@frame/.code={},
  before drawing frame+/.code={\pgfqkeys{/chronos}{@before@frame/.append code={#1}}},
  before drawing frame'/.code={\pgfqkeys{/chronos}{@before@frame/.code={#1}}},
  before drawing frame/.forward to=/chronos/before drawing frame+,
  tikz'/.forward to=/tikz/chronos tikz',
  tikz+/.forward to=/tikz/chronos tikz+,
  tikz/.forward to=/tikz/chronos tikz,
  tikz outside bb'/.forward to=/tikz/chronos tikz outside bb',
  tikz outside bb+/.forward to=/tikz/chronos tikz outside bb+,
  tikz outside bb/.forward to=/tikz/chronos tikz outside bb,
  % @tikz is for standard ; @@tikz ignores bb ; for both user code and chronos
  @tikz/.style={},
  @@tikz/.style={},
  % @timeline@config is for indirect user code or overwritable chronos ; @@ is reserved for chronos
  @timeline@config/.code={},
  @@timeline@config/.code={%
    \chronos@if@gosodF {@byw@cyfnodau} {\pgfqkeys{/chronos/byw}{dangos cyfnodau}}%
    \chronos@if@gosodF {@parhad@cyfnodau} {\pgfqkeys{/chronos/parhad}{dangos cyfnodau}}%
    \chronos@if@gosodF {@digwyddiad@cyfnodau} {\pgfqkeys{/chronos/digwyddiad}{dangos cyfnodau}}%
    \chronos@if@gosodF {@byw@llawn} {\pgfqkeys{/chronos/byw}{blynyddoedd yn unig}}%
    \chronos@if@gosodF {@parhad@llawn} {\pgfqkeys{/chronos/parhad}{blynyddoedd yn unig}}%
    \chronos@if@gosodF {@digwyddiad@llawn} {\pgfqkeys{/chronos/digwyddiad}{dyddiadau llawn}}%
    \chronos@if@gosodF{timeline@years}{\pgfqkeys{/chronos/llinell amser}{blynyddoedd=ar y llinell}}%
    \ifchronos@yearsonline
      \chronos@ychwanegu@nodweddion@rhestr^{byw,parhad}{@llinell}{fill=####1,fill opacity=.25,draw=none}%
      \chronos@ychwanegu@nodweddion@rhestr^{digwyddiad}{@llinell}{draw=####1,fill=none,opacity=.25}%
    \else
      \chronos@ychwanegu@nodweddion@rhestr^{byw,parhad}{@llinell}{draw=####1,thick,fill opacity=.75}%
      \chronos@ychwanegu@nodweddion@rhestr^{digwyddiad}{@llinell}{draw=####1,draw opacity=.75,fill=none}%
    \fi
    % efaillai bod yn anghywir tan inni ailosod yn hwyrach!! | maybe wrong until we reset later!!
    \let\timelineht\chronos@height
  },
  @style/.style={},
  @@timeline@config@diwedd/.style={},
  @@timeline@config@dechrau/.style={},  
  chronos tweak/.code={\pgfqkeys{/chronos}{@style/.append style={#1}}},
  chronos opacity/.code={%
    \ifchronos@preset\chronos@temptrue\else\chronos@tempfalse\fi
    \chronos@presettrue
    \pgfqkeys{/chronos}{%
      @style/.append style={transparency group,opacity=#1},
      every cysylltiadau+={opacity=#1},
      every cysylltwyr chronos+={opacity=#1},
      /chronos/prif/@frame/.append style={opacity=#1},
      /chronos/llinell amser/.cd,
      llinell+={draw opacity=#1,fill opacity=#1},
      timeline@bare@mark@on@line/.append style={opacity=#1},
      timeline@minor@mark@on@line/.append style={opacity=#1},
      timeline@mark@on@line/.append style={opacity=#1},
      timeline@bare@mark@off@line/.append style={opacity=#1},
      timeline@minor@mark@off@line/.append style={opacity=#1},
      timeline@mark@off@line/.append style={opacity=#1},
      timeline@year@on@line/.append style={opacity=#1},
      timeline@year@ff@line/.append style={opacity=#1},
%       timeline all marks={opacity=#1},
      border+={opacity=#1}}%
    \ifchronos@temp\chronos@presettrue\else\chronos@presetfalse\fi
  },
  % BEGIN dyddiadau (pgfcalendar)
  set date aux/.code={% paid â geisio dorri hwn - mae'n torri pethau'n ddrwg ond *dim ond yn nifer bach o achosion felly rhy hawdd i feddwl bod popeth yn iawn ...
    \chronos@set@date@aux{#1}%
  },
  % END dyddiadau (pgfcalendar)
  % BEGIN teitlau, pennawdau, isbennawdau etc.
  headings+/.code={% 
    \chronos@headingstrue
    \chronos@to@clist+{headings}{#1}%
  },
  heading+/.code n args=3{% name/content; start ; end
    \chronos@headingstrue
    \chronos@to@clist+{headings}{#1/#2/#3}%
  },
  subheading+/.code n args=4{% name/content; start ; end; pos
    \chronos@headingstrue
    \chronos@to@clist+{subheadings}{#1/#2/#3/#4}%
  },
  subheadings+/.code={% name/content; start ; end; pos
    \chronos@headingstrue
    \chronos@to@clist+{subheadings}{#1}%
  },
  heading'/.code n args=3{%
    \chronos@headingstrue
    \chronos@to@clist{headings}{#1/#2/#3}%
  },
  headings'/.code={%
    \chronos@headingstrue
    \chronos@to@clist{headings}{#1}%
  },
  subheading'/.code n args=4{%
    \chronos@headingstrue
    \chronos@to@clist{subheadings}{#1/#2/#3/#4}%
  },
  subheadings'/.code={%
    \chronos@headingstrue
    \chronos@to@clist{subheadings}{#1}%
  },
  century subheading+/.code 2 args={% name/content; start ; end; pos
    \chronos@headingstrue
    \chronos@global@to@clist+{century_subheadings}{#1/#2}%
  },
  century subheadings+/.code 2 args={% name/content; start ; end; pos
    \chronos@headingstrue
    \foreach \i in {#1} {\chronos@global@to@clist+{century_subheadings}{\i/#2}}%
  },
  century subheading'/.code 2 args={% name/content; start ; end; pos
    \chronos@headingstrue
    \chronos@global@to@clist{century_subheadings}{#1/#2}%
  },
  century subheadings'/.code 2 args={% name/content; start ; end; pos
    \chronos@headingstrue
    \chronos@global@clear@to@clist{century_subheadings}%
    \foreach \i in {#1} {\chronos@global@to@clist{century_subheadings}{\i/#2}}%
  },
  heading/.forward to=/chronos/heading+,
  headings/.forward to=/chronos/headings+,
  subheading/.forward to=/chronos/subheading+,
  subheadings/.forward to=/chronos/subheadings+,
  century subheading/.forward to=/chronos/century subheading+,
  century subheadings/.forward to=/chronos/century subheadings+,
  subheadings drops/.chronos 2 dimens={\chronos@subheading@drop@uchod}{\chronos@subheading@drop@isod},
  heading drop/.chronos dimen=\chronos@heading@drop,
  headings drops'/.code args={#1:#2:#3}{\chronos@heading@drop=#1 \chronos@subheading@drop@uchod=#2 \chronos@subheading@drop@isod=#3},
  headings drops'+/.code args={#1:#2:#3}{\advance \chronos@heading@drop by #1 \advance \chronos@subheading@drop@uchod by #2 \advance\chronos@subheading@drop@isod by #3},
  headings drops'-/.code args={#1:#2:#3}{\advance \chronos@heading@drop by -#1 \advance \chronos@subheading@drop@uchod by -#2 \advance\chronos@subheading@drop@isod by -#3},
  headings drops'=0pt:0pt:0pt,
  chronos coords'/.code={\chronos@to@clist{dyddiadau_coords}{#1}},
  chronos coords+/.code={\chronos@to@clist+{dyddiadau_coords}{#1}},
  chronos coords/.forward to=/chronos/chronos coords+,
  frame/.is if=chronos@frame,
  frame/.default=true,
  frame uses bb/.is if=chronos@framedefnyddiobb,
  frame/.default=true,
  % END teitlau, pennawdau, isbennawdau etc.
}
\ExplSyntaxOn
% set up every byw, every byw', every byw+, every life, every life', every life+ etc.; #3 gives default (' or +)
\__chronos_kexpandtotags:nnn { byw } { life } { + }
\__chronos_kexpandtotags:nnn { digwyddiad } { event } { + }
\__chronos_kexpandtotags:nnn { parhad } { period } { + }
\__chronos_kexpandtotags:nnn { theori } { theory } { + }
\__chronos_kexpandtotags:nnn { gwybodaeth } { info } { + }
% like kexpander but without every keys
\__chronos_kextripler:nnnnn { every ~ cylch ~ cylch ~ theori } { every ~ theory ~ circle ~ text } { every@cylch ~ cylch ~ theori } { + } { style }
\__chronos_kextripler:nnnnn { every ~ testun ~ cylch ~ theori } { every ~ theory ~ circle ~ circle } { every@testun ~ cylch ~ theori } { + } { style }
\__chronos_kextripler:nnnnn { llinell ~ amser / llinell } { timeline ~ line } { llinell ~ amser / timeline@line } { ' } { style }
\__chronos_kextripler:nnnnn { llinell ~ amser / border } { timeline ~ border } { llinell ~ amser / timeline@border } { ' } { style }
\__chronos_kextripler:nnnnn { prif / teitl } { prif / title } { prif / @teitl } { ' } { style }
\__chronos_kextripler:nnnnn { amserau } { subheadings ~ style } { @amserau } { ' } { style }
\__chronos_kextripler:nnnnn { amseraumawr } { headings ~ style } { @amseraumawr } { ' } { style }
\__chronos_kextripler:nnnnn { hawlfraint } { copyright } { @hawlfraint } { ' } { style }
\__chronos_kextripler:nnnnn { hawlfraint } { copyright } { @hawlfraint } { ' } { style }
\__chronos_kexforwardtriple:nn { hawlfraint } { copyleft }
\__chronos_kextripler:nnnn { timeline ~ config } {@timeline@config } { + } { code }
\__chronos_kextripler:nnnn { gwybodaeth / label } { gwybodaeth / @label } { ' } { style }
\__chronos_kextripler:nnnn { prif / frame } { prif / @frame } { ' } { style }
\__chronos_kextripler:nnnn { theori / cylchau / label } { theori / cylchau / @label } { ' } { style }
\ExplSyntaxOff
\pgfqkeys{/chronos}{%
  % BEGIN every (digwyddiad, byw, parhad, theori)
  every@cylch cylch theori/.style={fill=chronos@prifliw, draw=chronos@prifliw, even odd rule},
  every@testun cylch theori/.style={decoration={text effects along path, text={#1}, text effects/.cd, fit text to path, text=chronos@prifliw@cefndir, characters={text along path, font=\scriptsize\scshape}}, decorate},
  every byw isod/.code={\chronos@every@byw@isodtrue\chronos@every@byw@uchodfalse\chronos@byw@isodtrue},
  every digwyddiad isod/.code={\chronos@every@digwyddiad@isodtrue\chronos@every@digwyddiad@uchodfalse\chronos@digwyddiad@isodtrue},
  every parhad isod/.code={\chronos@every@parhad@isodtrue\chronos@every@parhad@uchodfalse\chronos@parhad@isodtrue},
  every byw uchod/.code={\chronos@every@byw@uchodtrue\chronos@every@byw@isodfalse\chronos@byw@isodfalse},
  every digwyddiad uchod/.code={\chronos@every@digwyddiad@uchodtrue\chronos@every@digwyddiad@isodfalse\chronos@digwyddiad@isodfalse},
  every parhad uchod/.code={\chronos@every@parhad@uchodtrue\chronos@every@parhad@isodfalse\chronos@parhad@isodfalse},
  % BEGIN every (digwyddiad, byw, parhad, theori) saesneg
  every life below/.forward to=/chronos/every byw isod,
  every period below/.forward to=/chronos/every parhad isod,
  every event below/.forward to=/chronos/every digwyddiad isod,
  every life above/.forward to=/chronos/every byw uchod,
  every period above/.forward to=/chronos/every parhad uchod,
  every event above/.forward to=/chronos/every digwyddiad uchod,
  % END every (digwyddiad, byw, parhad, theori) saesneg
  % END every (digwyddiad, byw, parhad, theori)
}
\tikzset{%
  % BEGIN llinell amser | timeline
  /chronos/llinell amser/.code={\pgfqkeys{/chronos/llinell amser}{#1}},
  /chronos/timeline/.forward to=/chronos/llinell amser,
  /chronos/timeline/.chronos search=llinell amser,
  /chronos/llinell amser/.cd,
  timeline arrow/.is if=chronostimelinearrow,
  timeline arrow/.default=true,
  no timeline arrow/.code={\chronostimelinearrowfalse},
  timeline@arrow/.style={},
  no@timeline@arrow/.style={},
  do timeline arrow/.code={},
  conditional timeline arrow/.code 2 args={%
    \pgfqkeys{/chronos}{%
      llinell amser/.cd,
      timeline@arrow/.style={/chronos/.cd,#1},
      no@timeline@arrow/.style={/chronos/.cd,#2},
      do timeline arrow/.add code={%
        \ifchronostimelinearrow 
          \tikzset{/chronos/llinell amser/timeline@arrow}%
        \else
          \tikzset{/chronos/llinell amser/no@timeline@arrow}%
        \fi
      },
    }%
  },
  % BEGIN ffontiau
  ffont camau mawr/.store in=\chronos@ffont@camaumawr,
  ffont camau bach/.store in=\chronos@ffont@camaubach,
  ffont cyfnodau/.store in=\chronos@ffont@cyfnodau,
  ffont/.forward to=/chronos/llinell amser/ffont cyfnodau,
  ffont/.forward to=/chronos/llinell amser/ffont camau bach,
  ffont/.forward to=/chronos/llinell amser/ffont camau mawr,
  % BEGIN ffontiau saesneg
  major step font/.forward to=/chronos/llinell amser/ffont camau mawr,
  minor step font/.forward to=/chronos/llinell amser/ffont camau bach,
  eras font/.forward to=/chronos/llinell amser/ffont cyfnodau,
  timeline font/.forward to=/chronos/llinell amser/ffont,
  % END ffontiau saesneg
  % END ffontiau
  % BEGIN llinell amser | timeline
  % BEGIN hydoedd % haenau  (dim dyfnder?)
  border ar/.chronos layer choice=border,
  border ar=background,
  llinell amser ar/.chronos layer choice=llinell amser,
  llinell amser ar=foreground,
  % BEGIN hydoedd & haenau saesneg
  border on/.forward to=/chronos/llinell amser/border ar,
  timeline on/.forward to=/chronos/llinell amser/llinell amser ar,
  % END hydoedd & haenau saesneg
  % END hydoedd & haenau
  % BEGIN dyddiadau
  dyddiad diwedd/.style={%
    /chronos/@@timeline@config@diwedd/.code={%
      \pgfqkeys{/chronos}{set date aux/.expanded={#1-12-31-0@end}}%
    },
  },
  dyddiad dechrau/.style={%
    /chronos/@@timeline@config@dechrau/.code={%
      \pgfqkeys{/chronos}{set date aux/.expanded={#1-01-01-0@start}}%
    },
  },
  dyddiadau/.code args={#1:#2}{% angen y llinell nesaf am y saesneg yn unig <= ???!!
    \pgfqkeys{/chronos/llinell amser}{dyddiad dechrau=#1,dyddiad diwedd=#2}%
  },
  % END dyddiadau
  % BEGIN camau
  cam blwyddyn fawr/.store in=\chronos@cam@blwyddyn@fawr, % oedd cam mawr
  cam blwyddyn fach/.store in=\chronos@cam@blwyddyn@fach, % oedd cam bach
  rhaniadau cam/.store in=\chronos@camrhaniadau,% cam rhaniadau % oedd camau bach / \chronos@minorsteps
  camu o flwyddyn/.store in=\chronos@stepfrom,
  cam blwyddyn/.code={%
    \pgfqkeys{/chronos/llinell amser}{cam blwyddyn fawr=#1}%
    \Undefine\chronos@cam@blwyddyn@fach
  },
  % END camau
  % BEGIN lliwiau y llinell amser
  lliw mewnol y border/.chronos lliw=borderinner,
  timeline border inner colour/.forward to=/chronos/llinell amser/lliw mewnol y border,
  timeline border inner color/.forward to=/chronos/llinell amser/lliw mewnol y border,
  lliw allanol y border/.chronos lliw=borderouter,
  timeline border outer colour/.forward to=/chronos/llinell amser/lliw allanol y border,
  timeline border outer color/.forward to=/chronos/llinell amser/lliw allanol y border,
  lliw canol y border/.chronos lliw=bordermiddle,
  timeline border middle colour/.forward to=/chronos/llinell amser/lliw canol y border,
  timeline border middle color/.forward to=/chronos/llinell amser/lliw canol y border,
  cefndir/.chronos lliw=lliw@cefndir@llinell,
  blaendir/.chronos lliw=lliw@llinell,
  timeline background/.forward to=/chronos/llinell amser/cefndir,
  timeline foreground/.forward to=/chronos/llinell amser/blaendir,
  background/.forward to=/chronos/llinell amser/cefndir,
  foreground/.forward to=/chronos/llinell amser/blaendir,
  % END lliwiau y llinell amser
  % BEGIN nodau a blynyddoedd | marks and years
  nodi cyfnodau/.is if=chronos@markeras,% cyfnodau ar y llinell amser
  @nodi cyfnodau/.code={\chronos@ychwanegu@gosod{markeras}},
  nodi cyfnodau/.forward to=/chronos/llinell amser/@nodi cyfnodau,
  timeline mark eras/.forward to=/chronos/llinell amser/nodi cyfnodau,
  mark eras/.forward to=/chronos/llinell amser/nodi cyfnodau,
  timeline years set/.store in=\chronos@timelineyears,
  blynyddoedd/.is choice,
  timeline years/.forward to=/chronos/llinell amser/blynyddoedd,
%   blynyddoedd y llinell amser/.forward to=/chronos/llinell amser/blynyddoedd,
  blynyddoedd/.forward to=/chronos/llinell amser/timeline years set,
  blynyddoedd/dim/.code={%
    \chronos@timeline@showyearsfalse
    \chronos@blynyddoedduchodfalse
    \chronos@blynyddoeddisodfalse
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@years/.style={},
      angor blynyddoedd=base,
    }% 
  },% oedd /chronos/llinell amser/heb flynyddoedd
  blynyddoedd/none/.forward to=/chronos/llinell amser/blynyddoedd/dim,% oedd /chronos/timeline no years
  blynyddoedd/uchod/.code={% 
    \chronos@yearsonlinefalse
    \chronos@blynyddoedduchodtrue
    \chronos@blynyddoeddisodfalse
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@years/.style={above, anchor=\chronos@timelineyearsanchor, yshift=.5*\chronos@height},
      angor blynyddoedd=south,
    }%
  },
  blynyddoedd/above/.forward to=/chronos/llinell amser/blynyddoedd/uchod,
  blynyddoedd/isod/.code={%
    \chronos@yearsonlinefalse
    \chronos@blynyddoedduchodfalse
    \chronos@blynyddoeddisodtrue
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@years/.style={below, anchor=\chronos@timelineyearsanchor, yshift=-.5*\chronos@height},
      angor blynyddoedd=north,
    }%
  },
  blynyddoedd/below/.forward to=/chronos/llinell amser/blynyddoedd/isod,
  blynyddoedd/ar y llinell/.code={%
    \chronos@yearsonlinetrue
    \chronos@blynyddoedduchodfalse
    \chronos@blynyddoeddisodfalse
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@years/.style={anchor=\chronos@timelineyearsanchor},
      angor blynyddoedd=center,
    }%
  },
  blynyddoedd/on line/.forward to=/chronos/llinell amser/blynyddoedd/ar y llinell,
  blynyddoedd/off line/.code={%    
    \IfBooleanExprTF {%
      ! ( \LegacyBoolean {chronos@blynyddoedduchod} || \LegacyBoolean {chronos@blynyddoeddisod} )
    }{%
      \pgfqkeys{/chronos/llinell amser}{blynyddoedd=uchod}%
    }{%
      \chronos@yearsonlinefalse
    }%
  },  
  blynyddoedd/.chronos track=timeline@years,
  angor blynyddoedd/.store in=\chronos@timelineyearsanchor,
  angor blynyddoedd/.chronos track={angor@blynyddoedd},
  timeline years anchor/.forward to=/chronos/llinell amser/angor blynyddoedd,
  blwyddyn sero/.is if=chronos@yearzero,
  year zero/.forward to=/chronos/llinell amser/blwyddyn sero,
  mark at era switch/.is if=chronos@markateraswitch,
  mark at era switch/.default=true,
  @mark at era switch/.code={\chronos@ychwanegu@gosod{markateraswitch}},
  mark at era switch/.forward to=/chronos/llinell amser/@mark at era switch,
  year at era switch/.code={%
    \chronos@legacy@if@set{chronos@temp}{#1}%
    \ifchronos@temp
      \chronos@markateraswitchfalse
    \else
      \chronos@markateraswitchtrue
    \fi
    \chronos@ychwanegu@gosod{markateraswitch}},
  year at era switch/.default=true,
  blynyddoedd bychain/.is if=chronos@minoryears,
  blynyddoedd bychain/.default=true,
  minor years/.forward to=/chronos/llinell amser/blynyddoedd bychain,
  nodau/.is if=chronos@marks,
  nodau/.default=true,
  timeline marks/.forward to=/chronos/llinell amser/nodau,
  nodau bach/.is if=chronos@marks@minor,
  nodau bach/.default=true,
  timeline minor marks/.forward to=/chronos/llinell amser/nodau bach,
  dangos blynyddoedd/.is if=chronos@timeline@showyears,
  dangos blynyddoedd/.default=true,
  timeline show years/.forward to=/chronos/llinell amser/dangos blynyddoedd,
  nodau noeth/.is if=chronos@marks@bare,
  nodau noeth/.default=true,
  nodau noeth/.chronos track={@bare},
  timeline bare marks/.forward to=/chronos/llinell amser/nodau noeth,
  timeline@year@off@line/.style={text=chronos@lliw@llinell, text opacity=1, align=center, fill opacity=.75, anchor=\chronos@timelineyearsanchor},
  timeline@mark@off@line/.style={draw=chronos@lliw@llinell, {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-, thin, shorten >=-2.5pt},
  timeline@minor@mark@off@line/.style={draw=chronos@lliw@llinell, {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-, very thin, shorten >=-2.5pt},
  era switch off line/.style={thick, shorten >=0pt},
  timeline@bare@mark@off@line/.style={draw=chronos@lliw@llinell, {Triangle[width=0pt 3,reversed,length=0pt 1.5]}-, very thin, shorten >=-1.5pt},
  timeline@year@on@line/.style={text=chronos@lliw@llinell, anchor=center},
  timeline@mark@on@line/.style={draw=chronos@lliw@llinell},
  timeline@minor@mark@on@line/.style={draw=chronos@lliw@llinell, thin},
  timeline@bare@mark@on@line/.style={draw=chronos@lliw@llinell, thick},
  timeline mark@too/.code={%
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@mark@on@line/.append style={#1},
      timeline@mark@off@line/.append style={#1},
    }%
  },
  timeline minor mark@too/.code={%
    \pgfqkeys{/chronos/llinell amser}{%
      timeline minor marks,
      timeline@minor@mark@on@line/.append style={#1},
      timeline@minor@mark@off@line/.append style={#1},
    }%
  },
  timeline bare mark@too/.code={%
    \pgfqkeys{/chronos/llinell amser}{%
      timeline bare marks,
      timeline@bare@mark@on@line/.append style={#1},
      timeline@bare@mark@off@line/.append style={#1},
    }%
  },
  timeline year@too/.code={%
    \pgfqkeys{/chronos/llinell amser}{%
      timeline@year@on@line/.append style={#1},
      timeline@year@off@line/.append style={#1},
    }%
  },
  % END nodau a blynyddoedd | marks and years
  % END llinell amser | timeline 
}
\ExplSyntaxOn
% forward each key in #3 to the key in #2; all keys on /chronos/#1
\__chronos_kexforwarder:nnn { llinell ~ amser } { timeline ~ mark@too } { timeline ~ mark, timeline ~ all ~ marks }
\__chronos_kexforwarder:nnn { llinell ~ amser } { timeline ~ minor ~ mark@too } { timeline ~ minor ~ mark, timeline ~ all ~ marks }
\__chronos_kexforwarder:nnn { llinell ~ amser } { timeline ~ bare ~ mark@too } { timeline ~ bare ~ mark, timeline ~ all ~ marks }
\__chronos_kexforwarder:nnn { llinell ~ amser } { timeline ~ year@too } { timeline ~ year, timeline ~ all ~ marks }
\__chronos_kexforwarder:nnn { llinell ~ amser } {dyddiadau } { dates }
\__chronos_kexforwarder:nnn { llinell ~ amser } {dyddiad ~ dechrau } {  dechrau, start ~ date, start }
\__chronos_kexforwarder:nnn { llinell ~ amser } {dyddiad ~ diwedd } {  diwedd, end ~ date, end }
\__chronos_kexforwarder:nnn { llinell ~ amser } {cam ~ blwyddyn ~ fawr } { step ~ major ~ years, step ~ major ~ year, cam ~ blwyddyn ~ mawr }
\__chronos_kexforwarder:nnn { llinell ~ amser } {cam ~ blwyddyn ~ fach } { cam ~ blynyddoedd ~ bach, step ~ minor ~ years, step ~ minor ~ year }
\__chronos_kexforwarder:nnn { llinell ~ amser } {rhaniadau ~ cam } { step ~ divisions } % oedd camau bach, minor steps
\__chronos_kexforwarder:nnn { llinell ~ amser } {cam ~ blwyddyn } { cam ~ blynyddoedd, step ~ years, step ~ year }
\__chronos_kexforwarder:nnn { llinell ~ amser } {camu ~ o ~ flwyddyn } { step ~ from ~ year }
\ExplSyntaxOff
\pgfqkeys{/chronos}{%
  % BEGIN testun
  ce year label/.store in=\chronos@yearce,
  bce year label/.store in=\chronos@yearbce,
  timeline ce label/.store in=\chronos@ce,
  timeline bce label/.store in=\chronos@bce,
  % END testun  
  % BEGIN lliwiau
  cefndir/.chronos lliw=prifliw@cefndir,
  background/.forward to=/chronos/cefndir,
  blaendir/.chronos lliw=prifliw,
  foreground/.forward to=/chronos/blaendir,
  troi lliwiau/.code={\chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/troi lliwiau=#1}%
    \chronos@legacy@if@set{chronos@troilliwiau}{#1}%
  },
  troi lliwiau/.default=true,
  colour rotation/.forward to=/chronos/troi lliwiau,
  color rotation/.forward to=/chronos/troi lliwiau,
  heb droi lliwiau/.code={\chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/troi lliwiau=false}%
    \chronos@troilliwiaufalse
  },
  no colour rotation/.forward to=/chronos/heb droi lliwiau,
  no color rotation/.forward to=/chronos/heb droi lliwiau,
  troi pob liw/.style={/chronos/.cd, byw/troi lliwiau=true, digwyddiad/troi lliwiau=true, parhad/troi lliwiau=true, theori/troi lliwiau=true, troi lliwiau=true},
  rotate all colours/.forward to=/chronos/troi pob liw,
  rotate all colors/.forward to=/chronos/troi pob liw,
  troi dim lliwiau/.style={/chronos/.cd, byw/troi lliwiau=false, digwyddiad/troi lliwiau=false, parhad/troi lliwiau=false, theori/troi lliwiau=false, heb droi lliwiau},
  rotate no colours/.forward to=/chronos/troi dim lliwiau,
  rotate no colors/.forward to=/chronos/troi dim lliwiau,
  % END lliwiau
  % BEGIN lefelau
  lefelau/.style args={#1:#2}{
	/chronos/uchod=#1,
	/chronos/isod=#2,
  },
  lefelau at/.store in=\chronos@lefelau@at,
  lefelau at=chronos mid,
  uchod/.store in=\chronos@uchod,
  isod/.store in=\chronos@isod,
  % END lefelau
  % BEGIN formats
  fformat dyddiad/.code={\chronos@setdateformat{#1}},
  date format/.forward to=/chronos/fformat dyddiad,
  year format/.code={\chronos@setyearformat{#1}},
  minor year format/.code={\chronos@setminoryearformat{#1}},
  dangos cyfnodau/@blynyddoedd yn unig/.code={\chronos@setdateformat{!Y\thinspace !E}},
  dangos cyfnodau/@llawn/.code={\chronos@setdateformat{!d/!m/!Y\thinspace !E}},
  dangos cyfnodau/llawn/.code={\pgfqkeys{/chronos/dangos cyfnodau}{@llawn/.code={\chronos@setdateformat{#1}}}},
  dangos cyfnodau/blynyddoedd yn unig/.code={\pgfqkeys{/chronos/dangos cyfnodau}{@blynyddoedd yn unig/.code={\chronos@setdateformat{#1}}}},
  heb gyfnodau/@blynyddoedd yn unig/.code={\chronos@setdateformat{!Y}},
  heb gyfnodau/@llawn/.code={\chronos@setdateformat{!d/!m/!Y}},
  heb gyfnodau/llawn/.code={\pgfqkeys{/chronos/heb gyfnodau}{@llawn/.code={\chronos@setdateformat{#1}}}},
  heb gyfnodau/blynyddoedd yn unig/.code={\pgfqkeys{/chronos/heb gyfnodau}{@blynyddoedd yn unig/.code={\chronos@setdateformat{#1}}}},
  blynyddoedd yn unig/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/blynyddoedd yn unig}%
    \chronos@ychwanegu@nodweddion{byw}{@tag}{/chronos/blynyddoedd yn unig}%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/blynyddoedd yn unig}%
    \chronos@ychwanegu@nodweddion{parhad}{@tag}{/chronos/blynyddoedd yn unig}%
    \chronos@dimondblynyddoeddtrue
    \ifchronos@dangoscyfnodau
      \pgfqkeys{/chronos}{%
        dangos cyfnodau/@blynyddoedd yn unig,
      }%
    \else
      \pgfqkeys{/chronos}{%
        heb gyfnodau/@blynyddoedd yn unig,
      }%
    \fi
  },
  only years/.forward to=/chronos/blynyddoedd yn unig,
  dyddiadau llawn/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/dyddiadau llawn}%
    \chronos@ychwanegu@nodweddion{byw}{@tag}{/chronos/dyddiadau llawn}%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/dyddiadau llawn}%
    \chronos@ychwanegu@nodweddion{parhad}{@tag}{/chronos/dyddiadau llawn}%
    \chronos@dimondblynyddoeddfalse
    \ifchronos@dangoscyfnodau
      \pgfqkeys{/chronos}{%
        dangos cyfnodau/@llawn,
      }%
    \else
      \pgfqkeys{/chronos}{%
        heb gyfnodau/@llawn,
      }%
    \fi
  },
  full dates/.forward to=/chronos/dyddiadau llawn,
  dangos cyfnodau/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/dangos cyfnodau}%
    \chronos@ychwanegu@nodweddion{byw}{@tag}{/chronos/dangos cyfnodau}%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/dangos cyfnodau}%
    \chronos@ychwanegu@nodweddion{parhad}{@tag}{/chronos/dangos cyfnodau}%
    \chronos@dangoscyfnodautrue
    \ifchronos@dimondblynyddoedd
      \pgfqkeys{/chronos}{%
        dangos cyfnodau/@blynyddoedd yn unig,
      }%
    \else
      \pgfqkeys{/chronos}{%
        dangos cyfnodau/@llawn,
      }%
    \fi
  },
  show eras/.forward to=/chronos/dangos cyfnodau,
  heb gyfnodau/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/heb gyfnodau}%
    \chronos@ychwanegu@nodweddion{byw}{@tag}{/chronos/heb gyfnodau}%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/heb gyfnodau}%
    \chronos@ychwanegu@nodweddion{parhad}{@tag}{/chronos/heb gyfnodau}%
    \chronos@dangoscyfnodaufalse
    \ifchronos@dimondblynyddoedd
      \pgfqkeys{/chronos}{%
        heb gyfnodau/@blynyddoedd yn unig,
      }%
    \else
      \pgfqkeys{/chronos}{%
        heb gyfnodau/@llawn,
      }%
    \fi
  },
  without eras/.forward to=/chronos/heb gyfnodau,
  show eras/only years/.forward to=/chronos/dangos cyfnodau/blynyddoedd yn unig,
  show eras/full dates/.forward to=/chronos/dangos cyfnodau/dyddiadau llawn,
  without eras/only years/.forward to=/chronos/heb gyfnodau/blynyddoedd yn unig,
  without eras/full dates/.forward to=/chronos/heb gyfnodau/dyddiadau llawn,
  heb gyfnodau/.chronos track={@digwyddiad@cyfnodau,@byw@cyfnodau,@parhad@cyfnodau},
  dangos cyfnodau/.chronos track={@digwyddiad@cyfnodau,@byw@cyfnodau,@parhad@cyfnodau},
  dyddiadau llawn/.chronos track={@digwyddiad@llawn,@byw@llawn,@parhad@llawn},
  blynyddoedd yn unig/.chronos track={@digwyddiad@llawn,@byw@llawn,@parhad@llawn},
  every date format/.code={% defnyddio macros yn lle allweddau rhag ofn , yn #1 => pam ar ddaear?
    \chronos@setdateformat{#1}%
    \def\chronos@digwyddiad@fformatdyddiad{#1}%
    \def\chronos@parhad@fformatdechrau@cyfnod{#1}%
    \def\chronos@parhad@fformatdechrau@cyfnodau{#1}%
    \def\chronos@parhad@fformatdiwedd{#1}%
    \def\chronos@byw@fformatgeni@cyfnod{#1}%
    \def\chronos@byw@fformatgeni@cyfnodau{#1}%
    \def\chronos@byw@fformatmarw{#1}%
  },
  every date format/.chronos track={@digwyddiad@fformatiau@dyddiadau,@digwyddiad@cyfnodau,@digwyddiad@llawn},
  every date format/.chronos track={@byw@fformatiau@dyddiadau,@byw@cyfnodau,@byw@llawn},
  every date format/.chronos track={@parhad@fformatiau@dyddiadau,@parhad@cyfnodau,@parhad@llawn},
  testun yn unig/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/testun yn unig}%
    \chronos@setdateformat{}%
    \chronos@onlytexttrue
  },
  only text/.forward to=/chronos/testun yn unig,
  event years on line/.code={% 
    \chronos@eventyearsonlinetrue
    \chronos@timeline@showyearsfalse
    \pgfqkeys{/chronos/digwyddiad}{blynyddoedd yn unig,heb gyfnodau}%
    \chronos@onlytexttrue
  },
  event year on line/.style={/chronos/llinell amser/timeline@years, /chronos/llinell amser/timeline@year@on@line, font=\chronos@ffont@camaumawr},
  event year on line skip/.code={\gdef\chronos@specialdate{}},
  event dates split/.is if=chronos@eventdatessplit,
  event date split/.style={},
  testun yshift/.code={%
    \pgfmathparse{#1}%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/testun yshift=\pgfmathresult pt}%
    \chronos@testun@yshift=\pgfmathresult pt
  },
  testun yshift'/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/testun yshift=#1}%
    \chronos@testun@yshift=#1
  },
  testun yshift+/.code={%
    \pgfmathparse{#1}%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/testun yshift'+=\pgfmathresult pt}%
    \advance \chronos@testun@yshift by \pgfmathresult pt
  },
  testun yshift'+/.code={%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{/chronos/testun yshift'+=#1}%
    \advance \chronos@testun@yshift by #1
  },
  text tag yshift/.forward to=/chronos/testun yshift,
  text tag yshift'/.forward to=/chronos/testun yshift,
  text tag yshift'+/.forward to=/chronos/testun yshift,
  text tag yshift+/.forward to=/chronos/testun yshift,
  special date/.code={\gdef\chronos@specialdate{#1}},
  % saesneg: /chronos (mwy uchod)
  levels/.forward to=/chronos/lefelau,
  levels at/.forward to=/chronos/lefelau at,
  % END formats
  % BEGIN placeholders
  % ateb Qrrbrbirlbel https://tex.stackexchange.com/a/694967/
  % permission for LPPL: https://tex.stackexchange.com/questions/694799/how-can-i-disable-shadows-and-similar-preaction-postaction-effects-in-tikz-or/694967#comment1725164_694967
  discard node/.code={% ^^
    \setbox\pgfutil@tempboxa\box\pgfutil@voidb@x % empty out box
    \def\tikz@whichbox{\pgfutil@tempboxa}%
  },
  phantom node/.code=\tikz@addoption{% ateb Qrrbrbirlbel uchod ac ateb arall fe: https://tex.stackexchange.com/a/688111/ ; defnyddio yn lle \chronosphantom
    \expandafter\let\csname pgf@sh@boxes@\tikz@shape\endcsname\pgfutil@empty},
  % sylwad Qrrbrbirlbel: https://tex.stackexchange.com/questions/694799/how-can-i-disable-shadows-and-similar-preaction-postaction-effects-in-tikz-or?noredirect=1#comment1724762_694799
  zap preactions/.code=\let\tikz@preactions\@empty,
  zap postactions/.code=\let\tikz@postactions\@empty,
  placeholders/.is choice,
  placeholders/off/.code={%
    \chronos@placeholdersfalse
    \pgfqkeys{/chronos}{%
      placeholder/.style={fill=none, draw=none,/chronos/discard node},%phantom node,zap preactions,zap postactions},
    }%
  },
  placeholders/on/.code={%
    \pgfqkeys{/chronos}{%
      placeholder/.style={on chronos middle ground layer,fill opacity=.1,draw opacity=.25,text opacity=.5,/chronos/.cd,zap preactions,zap postactions},
    }%
  },
  placeholders/.default=on,
  placeholders=off,
  placeholder lines/.style={help lines, every node/.append style={rotate=-90,anchor=south,pos=.25,inner sep=0pt}},
  % END placeholders
  % BEGIN show coords
  show coords/.is if=chronos@showcoords,
  show coords/.default=true,
  show nodes/.is if=chronos@shownodes,
  show nodes/.default=true,
  show coordinate/.style n args=5{fill=#1, circle, anchor=center, inner sep=1pt, text=#1, pin={[#1, inner sep=0pt, pin edge={draw=#1}, pin distance=#4, #5]#2:#3}},
  show coord/.style 2 args={/chronos/show coordinate={chronos@lliw@coord}{#1}{#2}{30pt}{}},
  show node coord/.style 2 args={/chronos/show coordinate={chronos@lliw@node}{#1}{#2}{30pt}{}},
  show node/.style={},
  show bounding box/.is if=chronos@showbb,
  show bounding box/.default=true,
  show node colour/.chronos lliw=lliw@node,
  show bb colour/.chronos lliw=lliw@bb,
  show coordinate colour/.chronos lliw=lliw@coord,
  show node color/.forward to=/chronos/show node colour,
  show coordinate color/.forward to=/chronos/show coordinate colour,
  show bb color/.forward to=/chronos/show bb colour,
  show node colour=blue,
  show coordinate colour=red,
  show bb colour=chronosGreen,
  % END show coords
  dadfygio/.code={\pgfqkeys{/chronos}{placeholders,show coords,show node colour=blue,show coordinate colour=red,show bounding box,show nodes,show node/.style={draw=chronos@lliw@node}}},
  debug/.forward to=/chronos/dadfygio,
  % BEGIN digwyddiadau, bywydau, cysylltiadau rhwng y llinell a'r ddau
  enwau lliw syml/.is if=chronos@enwaulliwsyml,
  enwau lliw syml/.default=true,
  dim enwau lliw syml/.code={\chronos@enwaulliwsymlfalse},
  tags/.code={%
    \pgfqkeys{/chronos}{@tag/.style={#1}}%
    \chronos@cadw@nodweddion@rhag{@tag}{#1}},
  tags+/.code={%
    \pgfqkeys{/chronos}{@tag/.append style={#1}}%
    \chronos@ychwanegu@nodweddion@rhag{@tag}{#1}},
  tags={},
  cysylltiad ar/.chronos layer choice=cysylltiad,
  cysylltiadau ar/.forward to=/chronos/cysylltiad ar,
  cysylltiad ar=main,
  llinell ar/.chronos layer choice=llinell,
  llinellau ar/.forward to=/chronos/llinell ar,
  llinell ar=middle ground,
  % bocses a chysylltiadau theori
%   cysylltwr theori/.style={anchor=center},% oedd cylch cysylltu
  cysylltwyr theori/.forward to=/chronos/theori/cysylltwr testun,
%   {\pgfkeys{/chronos/theori/cysylltwr testun'={anchor=center, inner sep=0pt, outer sep=0pt,#1}}},% oedd cylchau cysylltu
%   cylchau theori/.code={\pgfqkeys{/chronos/theori/cylchau}{label cylch theori/.style={#1}}},
%   cylchau theori/.style={align=center, inner sep=0pt, outer sep=0pt, font=\scriptsize\scshape, text=chronos@prifliw},
  theori dash/.style={},
  lliwiau uchod/.code={\chronos@lliwiau@uchod{#1}},
  lliwiau isod/.code={\chronos@lliwiau@isod{#1}},
  lliwiau uchod o clist/.code={\chronos@global@eq@clist{lliwiau_uchod}{#1}},
  lliwiau isod o clist/.code={\chronos@global@eq@clist{lliwiau_isod}{#1}},
}
\ExplSyntaxOn
% set up /chronos/#1 with ' and + variants to set default #3; set up every #1 with ' and + variants to set default #1 and corresponding keys for tags in #5 ; use #4 as the default ; set up keys for forwarding using #2 as alias for #1
\__chronos_kexpander:nnnnn { llinellau } { lines } { @llinell } { ' } { byw, digwyddiad, parhad }
\__chronos_kexpander:nnnnn { cysylltwyr  ~ chronos } { chronos ~ connectors } { @cysylltwr@chronos } { + } { byw, digwyddiad, parhad }
\__chronos_kexpander:nnnnn { cysylltwyr ~ testun } { text ~ tag ~ connectors } { @cysylltwr@testun } { + } { byw, digwyddiad, parhad, theori }
\__chronos_kexpander:nnnnn { prif ~ gysylltwyr ~ testun } { main ~ text ~ tag ~ connectors } { @cysylltwr@testun@prif } { ' } { byw, digwyddiad, parhad, theori }
\__chronos_kexpander:nnnnn { cysylltiadau } { connections } { @cysylltiad } { ' } { byw, digwyddiad, parhad, theori }
\__chronos_kexpander:nnnnn { testunau } { text ~ tags } { @testun } { ' } { byw, digwyddiad, parhad, theori, gwybodaeth }
\__chronos_kexpander:nnnnn { fformat ~ dyddiad } { date ~ format } { @fformat@dyddiad } { ' } { byw, digwyddiad, parhad, theori, gwybodaeth }
\ExplSyntaxOff
\pgfqkeys{/chronos}{%
  llinell amser/.cd,
  lled/.chronos dimen=\chronos@width,
  uchder/.chronos dimen=\chronos@height,
  uchder y border/.chronos dimen=\chronos@borderheight,
  timeline era margin/.chronos dimen=\chronos@eramargin,
  timeline margin/.chronos dimen=\chronos@timelinemargin,
  timeline width/.chronos dimen=\chronos@width,
  width/.chronos dimen=\chronos@width,
  timeline height/.chronos dimen=\chronos@height,
  height/.chronos dimen=\chronos@height,
  timeline border height/.chronos dimen=\chronos@borderheight,
  /chronos/.cd,
  llinell yshift/.chronos dimen=\chronos@llinell@yshift,
  line yshift/.chronos dimen=\chronos@llinell@yshift,
  border penawdau/.chronos dimen=\chronos@border@penawdau,
  border pen/.chronos dimen=\chronos@border@pen,
  border gwaelod/.chronos dimen=\chronos@border@gwaelod,
  border de/.chronos dimen=\chronos@border@de,
  border chwith/.chronos dimen=\chronos@border@chwith,
  border allanol/.chronos dimen=\chronos@border@allanol,
  headings border/.chronos dimen=\chronos@border@penawdau,
  top border/.chronos dimen=\chronos@border@penawdau,
  bottom border/.chronos dimen=\chronos@border@gwaelod,
  right border/.chronos dimen=\chronos@border@de,
  left border/.chronos dimen=\chronos@border@chwith,
  outer border/.chronos dimen=\chronos@border@allanol,
}
\tikzset{/chronos/.cd,
  no connections/.code={%
    \chronos@byw@cysylltiadfalse
    \chronos@digwyddiad@cysylltiadfalse
    \chronos@parhad@cysylltiadfalse
  },
  no connectors/.code={%
    \pgfqkeys{/chronos}{every cysylltwyr testun'={coordinate},every cysylltwyr chronos'={coordinate}}},
  no text tag connectors/.code={%
    \pgfqkeys{/chronos}{every cysylltwyr testun'={coordinate}}},
  % BEGIN saesneg: digwyddiadau, bywydau, cysylltiadau rhwng y llinell a'r ddau
  simple colour names/.forward to=/chronos/enwau lliw syml,
  simple color names/.forward to=/chronos/enwau lliw syml,
  no simple colour names/.forward to=/chronos/dim enwau lliw syml,
  no simple color names/.forward to=/chronos/dim enwau lliw syml,
  connection/.forward to=/chronos/@cysylltiad,
  connection on/.forward to=/chronos/cysylltiad ar,
  connections on/.forward to=/chronos/cysylltiadau ar,
  colours above/.forward to=/chronos/lliwiau uchod,
  colours below/.forward to=/chronos/lliwiau isod,
  colors above/.forward to=/chronos/lliwiau uchod,
  colors below/.forward to=/chronos/lliwiau isod,
  colours above from clist/.forward to=/chronos/lliwiau uchod o clist,
  colours below from clist/.forward to=/chronos/lliwiau isod o clist,
  colors above from clist/.forward to=/chronos/lliwiau uchod o clist,
  colors below from clist/.forward to=/chronos/lliwiau isod o clist,
  lines on/.forward to=/chronos/llinell ar,
  line on/.forward to=/chronos/llinell ar,
%   line yshift/.forward to=/chronos/llinell yshift,
  % END saesneg: digwyddiadau, bywydau, cysylltiadau rhwng y llinell a'r ddau
  % END digwyddiadau, bywydau, cysylltiadau rhwng y llinell a'r ddau
  % END /chronos
}
% \ExplSyntaxOn
% % like kexpander but no every keys
% \__chronos_kextripler:nnnnn { amserau } { subheadings ~ style } { @amserau } { ' } { style }
% \__chronos_kextripler:nnnnn { amseraumawr } { headings ~ style } { @amseraumawr } { ' } { style }
% \__chronos_kextripler:nnnnn { hawlfraint } { copyright } { @hawlfraint } { ' } { style }
% \ExplSyntaxOff
\tikzset{%
  % BEGIN /chronos/byw
  /chronos/byw/.chronos tag init={byw}{life},
  /chronos/byw/.chronos tag dyddiadau init=byw:geni:marw:bu farw:bufarw:geni:marw:birth:death,
  /chronos/byw/.cd,
  % END /chronos/byw
  % BEGIN /chronos/digwyddiad
  /chronos/digwyddiad/.chronos tag init={digwyddiad}{event},
  /chronos/digwyddiad/.cd,
  dyddiad/.style={/chronos/set date aux/.expanded={#1-01-01-0@dig}},
  ffont dyddiad/.code={\def\chronos@digwyddiad@ffontdyddiad{#1}},
  ffont dyddiad=,
  fformat dyddiad/.code={%
    \def\chronos@digwyddiad@fformatdyddiad{#1}%
    \chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/digwyddiad/fformat dyddiad={#1}}%
  },
  fformat dyddiad/.chronos track={@digwyddiad@fformatiau@dyddiadau,@digwyddiad@cyfnodau,@digwyddiad@llawn},
  dangos cyfnodau/@blynyddoedd yn unig/.code={\def\chronos@digwyddiad@fformatdyddiad{!Y\thinspace !E}},
  dangos cyfnodau/@llawn/.code={\def\chronos@digwyddiad@fformatdyddiad{!d/!m/!Y\thinspace !E}},
  dangos cyfnodau/llawn/.code={\pgfqkeys{/chronos/digwyddiad/dangos cyfnodau}{@llawn/.code={\def\chronos@digwyddiad@fformatdyddiad{#1}}}},
  dangos cyfnodau/blynyddoedd yn unig/.code={\pgfqkeys{/chronos/digwyddiad/dangos cyfnodau}{@blynyddoedd yn unig/.code={\def\chronos@digwyddiad@fformatdyddiad{#1}}}},
  heb gyfnodau/@blynyddoedd yn unig/.code={\def\chronos@digwyddiad@fformatdyddiad{!Y}},
  heb gyfnodau/@llawn/.code={\def\chronos@digwyddiad@fformatdyddiad{!d/!m/!Y}},
  heb gyfnodau/llawn/.code={\pgfqkeys{/chronos/digwyddiad/heb gyfnodau}{@llawn/.code={\def\chronos@digwyddiad@fformatdyddiad{#1}},@llawn/.show code}},
  heb gyfnodau/blynyddoedd yn unig/.code={\pgfqkeys{/chronos/digwyddiad/heb gyfnodau}{@blynyddoedd yn unig/.code={\def\chronos@digwyddiad@fformatdyddiad{#1}}}},
  dangos cyfnodau/.code={\chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/dangos cyfnodau}},
  heb gyfnodau/.code={\chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/heb gyfnodau}},
  dyddiadau llawn/.code={\chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/dyddiadau llawn}},
  blynyddoedd yn unig/.code={\chronos@ychwanegu@nodweddion{digwyddiad}{@tag}{/chronos/blynyddoedd yn unig}},
  dangos cyfnodau/.chronos track={@digwyddiad@cyfnodau},
  dyddiadau llawn/.chronos track={@digwyddiad@llawn},
  heb gyfnodau/.chronos track={@digwyddiad@cyfnodau},
  blynyddoedd yn unig/.chronos track={@digwyddiad@llawn},
  % BEGIN saesneg: /chronos/digwyddiad
  date/.forward to=/chronos/digwyddiad/dyddiad,
  date font/.forward to=/chronos/digwyddiad/ffont dyddiad,
  date format/.forward to=/chronos/digwyddiad/fformat dyddiad,
  show eras/.forward to=/chronos/digwyddiad/dangos cyfnodau,
  only years/.forward to=/chronos/digwyddiad/blynyddoedd yn unig,
  full dates/.forward to=/chronos/digwyddiad/dyddiadau llawn,
  without eras/.forward to=/chronos/digwyddiad/heb gyfnodau,
  show eras/only years/.forward to=/chronos/digwyddiad/dangos cyfnodau/blynyddoedd yn unig,
  show eras/full dates/.forward to=/chronos/digwyddiad/dangos cyfnodau/dyddiadau llawn,
  without eras/only years/.forward to=/chronos/digwyddiad/heb gyfnodau/blynyddoedd yn unig,
  without eras/full dates/.forward to=/chronos/digwyddiad/heb gyfnodau/dyddiadau llawn,
  % END saesneg: /chronos/digwyddiad
  % END /chronos/digwyddiad
  % BEGIN /chronos/parhad
  /chronos/parhad/.chronos tag init={parhad}{period},
  /chronos/parhad/.chronos tag dyddiadau init=parhad:dechrau:diwedd:gorffenedig:gorffenedig:thing:otherthing:start:end,
  /chronos/parhad/.cd,
  % BEGIN saesneg: /chronos/parhad
  % END saesneg: /chronos/parhad
  % END /chronos/parhad
  % BEGIN /chronos/theori
  /chronos/theori/.chronos tag init={theori}{theory},
  /chronos/theori/.cd,
  % BEGIN saesneg: /chronos/thoeri
  % END saesneg: /chronos/thoeri
  % BEGIN /chronos/theori/cylchau
  /chronos/theori/cylchau/.cd,
  enw/.store in=\chronos@cylchtheori@enw,
%   fel y mae/.is if=chronos@felymae,
%   fel y mae/.default=true,
  chronos@tikzname/.code={%
    \chronos@creu@tikzname {cylchtheori}{#1}
  },
  enw/.forward to=/chronos/theori/cylchau/chronos@tikzname,
%   angor/.store in=\chronos@cylchtheori@angor,
%   angor/.forward to=/tikz/anchor,
%   at/.code yn gweithio am \cylchtheori ond ni weithio am \byw etc.
  at/.code={\coordinate (chronos@cylchtheori@at) at (#1);},
%   lliw/.store in=\chronos@cylchtheori@lliw,
%   meintiau/.style args={#1:#2}{
% 	/chronos/theori/cylchau/mawr=#1,
% 	/chronos/theori/cylchau/bach=#2,
%   },
  meintiau/.chronos 2 dimens={\chronos@cylchtheori@mawr}{\chronos@cylchtheori@bach},
  mawr/.chronos dimen=\chronos@cylchtheori@mawr,
  bach/.chronos dimen=\chronos@cylchtheori@bach,
  labeli/.style args={#1:#2}{
	/chronos/theori/cylchau/label uchod=#1,
	/chronos/theori/cylchau/label isod=#2,
  },
  label uchod/.store in=\chronos@cylchtheori@label@uchod,
  label isod/.store in=\chronos@cylchtheori@label@isod,
  testunau cylch/.style args={#1:#2}{
	/chronos/theori/cylchau/testun cylch uchod=#1,
	/chronos/theori/cylchau/testun cylch isod=#2,
  },
  testun cylch uchod/.store in=\chronos@cylchtheori@circletext@uchod,
  testun cylch isod/.store in=\chronos@cylchtheori@circletext@isod,
  % BEGIN /chronos/theori/cylchau saesneg
  /chronos/theory/circles/.chronos search=theori/cylchau,
  name/.forward to=/chronos/theori/cylchau/enw,
%   as is/.forward to=/chronos/theori/fel y mae,
%   tag anchor/.forward to=/chronos/theori/cylchau/angor,
  sizes/.chronos 2 dimens={\chronos@cylchtheori@mawr}{\chronos@cylchtheori@bach},
%   sizes/.forward to=/chronos/theori/cylchau/meintiau,
%   theory circle label/.forward to=/chronos/theori/cylchau/label cylch theori,
  circle texts/.forward to=/chronos/theori/cylchau/testunau cylch,
  labels/.forward to=/chronos/theori/cylchau/labeli,
  % END /chronos/theori/cylchau saesneg
  % END /chronos/theori/cylchau
  % END /chronos/theori
  % BEGIN /chronos/gwybodaeth
  /chronos/gwybodaeth/.cd,
  enw/.store in=\chronos@gwybodaeth@enw,
  chronos@tikzname/.code={%
    \chronos@creu@tikzname {gwybodaeth}{#1}
  },
  enw/.forward to=/chronos/gwybodaeth/chronos@tikzname,
%   fel y mae/.is if=chronos@felymae,
%   fel y mae/.default=true,
  angor/.store in=\chronos@gwybodaeth@angor,
%   angorau/.store in=\chronos@gwybodaeth@angorau,
  at/.store in=\chronos@gwybodaeth@at,
  capsiwn/.store in=\chronos@gwybodaeth@capsiwn,
%   label/.style={},
  lliw/.store in=\chronos@gwybodaeth@lliw,
  lliw rhagosodedig/.store in=\chronos@gwybodaeth@lliw@rhagosodedig,
  lliw rhagosodedig=chronos@lliw@gwybodaeth,
%   lliw rhagosodedig=chronos@prifliw,
%   lliwiau uchod/.code={%
%     \chronos@lliwiau@uchod[gwybodaeth]{#1}
%   },
%   lliwiau isod/.code={%
%     \chronos@lliwiau@isod[gwybodaeth]{#1}
%   },
%   lliwiau uchod o clist/.code={\chronos@global@eq@clist{lliwiau_gwybodaeth_uchod}{#1}},
%   lliwiau isod o clist/.code={\chronos@global@eq@clist{lliwiau_gwybodaeth_isod}{#1}},
  tag'/.code={%
    \chronos@cadw@nodweddion{gwybodaeth}{@tag}{#1}%
  },
  tag+/.code={%
    \chronos@ychwanegu@nodweddion{gwybodaeth}{@tag}{#1}%
  },
  testun'/.code={%
    \chronos@cadw@nodweddion{gwybodaeth}{@testun}{#1}%
  },
  testun+/.code={%
    \chronos@ychwanegu@nodweddion{gwybodaeth}{@testun}{#1}%
  },
  testun/.forward to=/chronos/gwybodaeth/testun',
  tag/.forward to=/chronos/gwybodaeth/tag+,
%   cysylltiad/.code={%
%     \chronos@cadw@nodweddion{gwybodaeth}{@cysylltiad}{#1}%
%   },
%   cysylltiad+/.code={%
%     \chronos@ychwanegu@nodweddion{gwybodaeth}{@cysylltiad}{#1}%
%   },
%   cysylltiad={},
%   cysylltwyr+/.code={% rhan o /chronos/gwybodaeth; paid â ddileu fe!!
%     \ifdef \chronos@cysylltwyr {%
%       \expandafter\def\expandafter\chronos@cysylltwyr\expandafter{\chronos@cysylltwyr,#1}%
%     }{\def\chronos@cysylltwyr{#1}}%
%   },
%   cysylltwyr/.forward to=/chronos/gwybodaeth/cysylltwyr+,
%   cysylltwyr'/.code={%
%     \def\chronos@cysylltwyr{#1}%
%   },
%   isod/.is if=chronos@gwybodaeth@isod,
%   troi lliwiau/.code={%
%     \pgfkeys{/chronos/every@gwybodaeth/.append style={/chronos/troi lliwiau=#1}}%
%   },
  cynnwys testun/.store in=\chronos@cynnwys@testun,
  cynnwys enw/.store in=\chronos@cynnwys@enw,
  % BEGIN saesneg: /chronos/gwybodaeth
  /chronos/info/.chronos search=gwybodaeth,
  name/.forward to=/chronos/gwybodaeth/enw,
%   as is/.forward to=/chronos/gwybodaeth/fel y mae,
  caption/.forward to=/chronos/gwybodaeth/capsiwn,
  colour/.forward to=/chronos/gwybodaeth/lliw,
  color/.forward to=/chronos/gwybodaeth/lliw,
  default colour/.forward to=/chronos/gwybodaeth/lliw rhagosodedig,
  default color/.forward to=/chronos/gwybodaeth/lliw rhagosodedig,
%   colours above/.forward to=/chronos/gwybodaeth/lliwiau uchod,
%   colours below/.forward to=/chronos/gwybodaeth/lliwiau isod,
%   colors above/.forward to=/chronos/gwybodaeth/lliwiau uchod,
%   colors below/.forward to=/chronos/gwybodaeth/lliwiau isod,
%   colours above from clist/.forward to=/chronos/gwybodaeth/lliwiau uchod o clist,
%   colours below from clist/.forward to=/chronos/gwybodaeth/lliwiau isod o clist,
%   colors above from clist/.forward to=/chronos/gwybodaeth/lliwiau uchod o clist,
%   colors below from clist/.forward to=/chronos/gwybodaeth/lliwiau isod o clist,
%   colour rotation/.forward to=/chronos/gwybodaeth/troi lliwiau,
%   color rotation/.forward to=/chronos/gwybodaeth/troi lliwiau,
%   connection/.forward to=/chronos/gwybodaeth/cysylltiad,
%   connection+/.forward to=/chronos/gwybodaeth/cysylltiad+,
  text tag/.forward to=/chronos/gwybodaeth/testun,
  text tag'/.forward to=/chronos/gwybodaeth/testun',
  text tag+/.forward to=/chronos/gwybodaeth/testun+,
%   connectors/.forward to=/chronos/gwybodaeth/cysylltwyr,
%   connectors'/.forward to=/chronos/gwybodaeth/cysylltwyr',
%   connectors+/.forward to=/chronos/gwybodaeth/cysylltwyr+,
  tag anchor/.forward to=/chronos/gwybodaeth/angor,
  text content/.forward to=/chronos/gwybodaeth/cynnwys testun,
  name content/.forward to=/chronos/gwybodaeth/cynnwys enw,
  % END saesneg: /chronos/gwybodaeth
  % END /chronos/gwybodaeth
  % BEGIN /chronos/prif
  /chronos/prif/.cd,
  enw/.store in=\chronos@prifdeitl@enw,
  chronos@tikzname/.code={%
    \chronos@creu@tikzname {prifdeitl}{#1}
  },
  enw/.forward to=/chronos/prif/chronos@tikzname,
  angor/.store in=\chronos@prifdeitl@angor,
  angor/.forward to=/tikz/anchor,
  at/.code={\coordinate (chronos@prifdeitl@at) at (#1);},
  cynnwys enw/.store in=\chronos@prifdeitl@cynnwys,
%   lliw/.store in=\chronos@prifdeitl@lliw,
  llinellau teitl/.style={/tikz/.cd,draw=chronos@prifliw,inner xsep=0pt,#1,append after command={(main title.north west)--(main title.north east) (main title.south west)--(main title.south east)},draw=none},
  % BEGIN /chronos/prif saesneg
  /chronos/main/.chronos search=prif,
  name/.forward to=/chronos/prif/enw,
  tag anchor/.forward to=/chronos/prif/angor,
  name content/.forward to=/chronos/prif/cynnwys enw,
  title lines/.forward to=/chronos/prif/llinellau teitl,
  % END /chronos/prif saesneg
  % END /chronos/prif
  % BEGIN /chronos/hawlfraint
  /chronos/hawlfraint/.cd,
  enw/.store in=\chronos@hawlfraint@enw,
  chronos@tikzname/.code={%
    \chronos@creu@tikzname {hawlfraint}{#1}
  },
  enw/.forward to=/chronos/hawlfraint/chronos@tikzname,
  angor/.store in=\chronos@hawlfraint@angor,
  angor/.forward to=/tikz/anchor,
  at/.code={\coordinate (chronos@hawlfraint@at) at (#1);},
  awdur/.store in=\chronos@hawlfraint@awdur,
  blwyddyn/.store in=\chronos@hawlfraint@blwyddyn,
  cynnwys enw/.store in=\chronos@hawlfraint@cynnwys,
  cylchdroi/.store in=\chronos@hawlfraint@cylchdroi,
%   lliw/.store in=\chronos@hawlfraint@lliw,
  notis/.code={\def\chronos@hawlfraint@notis##1##2{#1}\show\chronos@hawlfraint@notis},
  copyleft/.is if=chronos@copyleft,
  copyleft/.default=true,
  % BEGIN /chronos/hawlfraint saesneg
  /chronos/copyright/.chronos search=hawlfraint,
  /chronos/copyleft/.chronos search=hawlfraint,
  author/.forward to=/chronos/hawlfraint/awdur,
  name/.forward to=/chronos/hawlfraint/enw,
  name content/.forward to=/chronos/hawlfraint/cynnwys enw,
  notice/.forward to=/chronos/hawlfraint/notis,
  rotate/.forward to=/chronos/hawlfraint/cylchdroi,
  tag anchor/.forward to=/chronos/hawlfraint/angor,
  year/.forward to=/chronos/hawlfraint/blwyddyn,
  % END /chronos/hawlfraint saesneg
  % END /chronos/hawlfraint
  /chronos/.cd,
  % BEGIN /chronos frâm, borders, cysylltwyr, llinellau, testunau etc.
  borders'/.code args={#1:#2:#3:#4:#5:#6}{% penawdau:pen:de:gwaelod:chwith:allanol
    \chronos@border@penawdau=#1\chronos@border@pen=#2\chronos@border@de=#3\chronos@border@gwaelod=#4\chronos@border@chwith=#5\chronos@border@allanol=#6},
  borders'+/.code args={#1:#2:#3:#4:#5:#6}{% penawdau:pen:de:gwaelod:chwith:allanol
    \advance\chronos@border@penawdau by #1 \advance\chronos@border@pen by #2 \advance\chronos@border@de by #3 \advance\chronos@border@gwaelod by #4 \advance\chronos@border@chwith by #5 \advance\chronos@border@allanol by #6 },
  borders'-/.code args={#1:#2:#3:#4:#5:#6}{% penawdau:pen:de:gwaelod:chwith:allanol
    \advance\chronos@border@penawdau by -#1 \advance\chronos@border@pen by -#2 \advance\chronos@border@de by -#3 \advance\chronos@border@gwaelod by -#4 \advance\chronos@border@chwith by -#5 \advance\chronos@border@allanol by -#6 },
  cysylltwyr chronos={anchor=center,inner sep=0pt,outer sep=0pt},% oedd cylch chronos
  cysylltwyr testun={anchor=center,inner sep=0pt,outer sep=0pt},% oedd cylch
  prif gysylltwyr testun={},
%   llinellau={},
  @llinell/.style={},
%   testunau={align=left, outer xsep=0pt, inner xsep=5pt, minimum height=15pt, rounded corners=2pt, thick, fill=#1, opacity=1, fill opacity=.25, text opacity=1, draw=#1, font=\scshape},
  testunau+={outer sep=0pt,text=#1!75!black},% every eisiau ##
  cysylltiadau={draw=#1},
  % END /chronos frâm, borders, cysylltwyr, llinellau, testunau etc.
  % BEGIN cynlluniau lliwiau
  cynllun lliwiau/.code={\csname chronos@lliwiau@#1\endcsname},
  colour scheme/.forward to=/chronos/cynllun lliwiau,
  color scheme/.forward to=/chronos/cynllun lliwiau,
  lliwiau cronoleg/.code={%
    \chronos@lliwiau@cronoleg
    \@ifpackageloaded{memoize}(\mmzset{csname meaning to context={chronos@lliwiau@cronoleg}}){}%
  },
  lliwiau rhagosodedig/.code={\chronos@lliwiau@rhagosodedig},
  % END cynlluniau lliwiau
}

% END allweddau PGF/TikZ
% BEGIN style cronoleg
\pgfqkeys{/chronos}{%
  cronoleg/.style={% mewnol | internal
    /chronos/.cd,
    cronoleg/.meaning to context,
    cynllun lliwiau=cronoleg,
    byw/troi lliwiau=true,
    digwyddiad/troi lliwiau=true,
    parhad/troi lliwiau=true,
    theori/troi lliwiau=false,
    theori/lliw rhagosodedig=chronos@lliw@theori,
    digwyddiad/lliw rhagosodedig=chronos@prifliw!75!chronos@prifliw@cefndir,
    parhad/lliw rhagosodedig=chronos@prifliw!75!chronos@prifliw@cefndir,
    gwybodaeth/lliw rhagosodedig=chronos@lliw@gwybodaeth,
    cefndir=chronos@prifliw@cefndir,
    blaendir=chronos@prifliw,
    blynyddoedd yn unig,
    llinell amser={%
      timeline years=on line,
      llinell={chronos@lliw@cefndir@llinell, opacity=.8},
      ffont camau mawr=\normalfont\bfseries,
      ffont camau bach=\normalfont\bfseries\footnotesize,
      ffont cyfnodau=\normalfont\normalsize\bfseries,
      timeline year={text=chronos@lliw@llinell, align=center},
      timeline mark={draw=chronos@lliw@llinell, ultra thick, shorten >=1.5pt},
      timeline minor mark={draw=chronos@lliw@llinell, thick, shorten >=3pt},
%     timeline bare mark={draw=chronos@lliw@llinell, shorten >=3pt, shorten <=3pt},
      timeline height'=10mm,
      timeline border height'=2.5mm,
      width=235mm,
      cam blwyddyn fawr=500,
      cam blwyddyn fach=100,
      timeline border outer colour=chronos@prifliw@cefndir,
      timeline border inner colour=chronos@lliw@cefndir@llinell!80!chronos@borderouter,
      timeline border middle colour=chronos@lliw@cefndir@llinell!20!chronos@borderouter,
      timeline mark eras,
      timeline marks,
      minor years,
      llinell amser ar=foreground,
      border ar=background,
      start date={-500},
      end date=2050,
      timeline margin'=10pt,
      timeline era margin'=15pt,
%     camu o flwyddyn=none,
    },
    timeline ce label={CE},
    timeline bce label={BCE},
    cysylltiadau={draw=##1, opacity=.75, thick},
    cysylltwyr testun={fill=##1, fill opacity=1, circle, minimum size=5pt, anchor=center, inner sep=0pt, outer sep=0pt},
    cyffredin/cysylltiad/.style={draw=##1, opacity=.5, thick},
    every cysylltwyr chronos={fill=####1, opacity=.75, circle, minimum size=2.5pt, anchor=center, inner sep=0pt, outer sep=0pt},
    cyffredin/testun/.style={outer xsep=0pt, rounded corners=2pt, thick, text opacity=1, draw opacity=1, inner sep=2pt, fill opacity=.25, font=\scshape\footnotesize},
    digwyddiad/cysylltiad={/chronos/cyffredin/cysylltiad=##1},
    byw/cysylltiad={/chronos/cyffredin/cysylltiad=##1, opacity=.75},
    parhad/cysylltiad={/chronos/cyffredin/cysylltiad=##1},
    theori/cysylltiad={thick, draw=chronos@prifliw, double=chronos@prifliw@cefndir},
% %     digwyddiad/lliwiau isod={chronos@prifliw!75!chronos@prifliw@cefndir},
% %     digwyddiad/lliwiau uchod={chronos@prifliw!75!chronos@prifliw@cefndir},
    theori/cysylltwr testun={fill=chronos@prifliw@cefndir, circle, minimum size=5pt, anchor=center, inner sep=0pt, outer sep=0pt, thick, draw=chronos@prifliw},
    byw/testun={/chronos/cyffredin/testun, align=left, text=##1!50!black, fill=##1, draw=##1},
%     every digwyddiad+={only text},% yn hawsach i toggle on na off felly paid ag analluogi fel rhagosodedig
    digwyddiad/testun={/chronos/cyffredin/testun, align=left, text=##1!50!black, fill=##1, draw=##1},
    parhad/testun={/chronos/cyffredin/testun, align=left, text=##1!50!black, fill=##1,  draw=##1},
    theori/testun={/chronos/cyffredin/testun, align=center, inner sep=3pt, text=chronos@lliw@theori, fill=chronos@lliw@cefndir@theori, fill opacity=.8, draw=chronos@prifliw, double=chronos@prifliw@cefndir, font=\bfseries},
    byw/llinell={fill=##1, fill opacity=.25, draw=none},
    digwyddiad/llinell={draw=##1, draw opacity=.25, fill=none},
    parhad/llinell={fill=##1, fill opacity=.25, draw=none},
    llinell ar=main,
    cysylltiad ar=middle ground,
%     byw/lliwiau isod o clist={lliwiau_isod},
%     byw/lliwiau uchod o clist={lliwiau_uchod},
    theori/cylchau/label={align=center, inner sep=0pt, outer sep=0pt, font=\scriptsize\scshape, text=chronos@prifliw},
    every cylch cylch theori'={fill=chronos@prifliw, draw=chronos@prifliw, thick, even odd rule, fill opacity=.8},
    every testun cylch theori'={decoration={text effects along path, text={##1}, text effects/.cd, fit text to path, text=chronos@prifliw@cefndir, characters={text along path, font=\scriptsize\scshape}}, decorate},
    theori/cylchau/labels=:,
    theori/cylchau/circle texts=:,
    theori/cylchau/meintiau'=15pt:9pt,
    gwybodaeth/label={/chronos/@amserau, font=\itshape\footnotesize, anchor=north, yshift=-2.5pt},% oedd pethau
    gwybodaeth/testun={/chronos/cyffredin/testun, align=left, text=##1, outer sep=0pt, fill=chronos@lliw@cefndir@gwybodaeth, draw opacity=.8, text opacity=.8, font=\scriptsize, draw=chronos@prifliw},% oedd ee ? oedd testun ee?
    theori dash/.style={chronos@prifliw, opacity=.75, thick, densely dashed},
    theory dash/.link=/chronos/theori dash,
    amserau={align=center, anchor=base, inner sep=0pt, outer sep=0pt, color=chronos@prifliw!75!chronos@prifliw@cefndir, opacity=.8, font=\bfseries\itshape\footnotesize},
    amseraumawr={align=center, anchor=base, inner sep=0pt, outer sep=0pt, color=chronos@prifliw, opacity=.8, font=\bfseries},
    prif/frame={inner sep=5pt, ultra thick, draw=chronos@prifliw, double=chronos@prifliw@cefndir, fill=none},% oedd chronos@prifliw@cefndir
    prif/teitl={/chronos/prif/@frame, font=\Huge\bfseries, text=chronos@prifliw, anchor=center, align=center, rounded corners=5pt},
    borders'=55pt:0pt:105pt:15pt:7.5pt:5pt,
    headings drops'=10pt:10pt:7.5pt,
    hawlfraint={font=\footnotesize\bfseries, inner sep=0pt, outer sep=0pt, chronos@prifliw, fill=chronos@prifliw@cefndir},
%     hawlfraint/cylchdroi=90,
%     hawlfraint/angor=west,
    llinellau={color=black!50, opacity=.5},
    lefelau=10:10,
    special date=none,
    ce year label={\textsc{ce}},
    bce year label={\textsc{bce}},
    testun yshift=10pt,
    frame uses bb=false,
    frame,
  },
}
% END style cronoleg
\RequirePackage{chronos-lib-colschemes,chronos-lib-styles}
% BEGIN env y ddogfen
% BEGIN chronos
\NewDocumentEnvironment {chronos} { > { \TrimSpaces } O {} } {% http://tex.stackexchange.com/a/159856/ - Claudio Fiandrino
  \chronos@env@begin
  \begin{tikzpicture}[%
    align=center,
    anchor=mid,
    fixed point arithmetic,
    /chronos/.cd,
    prif/frame/.append code={\chronos@frametrue},
    prif/frame+/.append code={\chronos@frametrue},
    prif/frame'/.append code={\chronos@frametrue},
    #1,
    @@timeline@config@diwedd,
    @@timeline@config@dechrau,
    @@timeline@config@diwedd/.code={},
    @@timeline@config@dechrau/.code={},
    @@timeline@config,
    @@timeline@config/.code={},
    @timeline@config,
    @timeline@config/.code={},
    name prefix=\chronos@tikzprefix,
  ]%
%     \chronosshowpreset
%     \chronosshowfeatures
% %     
%   \IfFreeF \bagpuss {%
%     \chronosshowfeatures[digwyddiad]%
%     \chronosshowfeatures
%     \chronosshowfeatures[byw]
%     \chronosshowfeatures[parhad]
%     \chronosshowfeatures[theori]
%     \chronosshowfeatures[gwybodaeth]}
  \IfBooleanExprT { \CSFreeBoolean \chronos@startyear || \CSFreeBoolean \chronos@endyear  }
    {%
      \PackageError{chronos}{Missing start and/or end date for timeline.
        I will attempt to fathom the concept of a timeline without time, but I predict unpredictable results}{You must specify both a start and end date. If I try to start at the beginning or finish at the end, I exceed TeX's maximum dimension. Besides, what if time is cyclical? My author didn't tell me how to draw a 3D timeline.}%
      \IfFreeT \chronos@startyear {\chronos@set@date{1800}{01}{01}{start}}%
      \IfFreeT \chronos@endyear {\chronos@set@date{2050}{12}{31}{end}}%
    }%  
    \ifnum\thechronos@startdate>\thechronos@enddate
      \PackageWarning{chronos}{Sorry, but I cannot reverse time. Perhaps you could ask a metaphysician? Setting end to start and start to end}%
      % paid ag anghofio am awto-cywiro yn functions chronos re. blwyddyn sero
      \setcounter{chronos@tempcnta}{\thechronos@startdate}%
      \setcounter{chronos@startdate}{\thechronos@enddate}%
      \setcounter{chronos@enddate}{\thechronos@tempcnta}%
      \let\chronos@tmpstartyear\chronos@startyear
      \let\chronos@tmpstartmonth\chronos@startmonth
      \let\chronos@tmpstartday\chronos@startday
      \let\chronos@startyear\chronos@endyear
      \let\chronos@startmonth\chronos@endmonth
      \let\chronos@startday\chronos@endday
      \let\chronos@endyear\chronos@tmpstartyear
      \let\chronos@endmonth\chronos@tmpstartmonth
      \let\chronos@endday\chronos@tmpstartday
    \fi
    \begin{scope}[/chronos/@style]
      \extractcolorspec{chronos@lliw@llinell}{\chronos@templlll}%\show\chronos@templlll%
      \extractcolorspec{chronos@lliw@cefndir@llinell}{\chronos@templlllc}%\show\chronos@templlllc%
      \extractcolorspec{white}{\chronos@templlw}%\show\chronos@templlw%
      \extractcolorspec{chronos@prifliw}{\chronos@templlpl}%\show\chronos@templlpl%
      \extractcolorspec{chronos@prifliw@cefndir}{\chronos@templlplc}%\show\chronos@templlplc%
      \ifchronos@yearsonline % BEGIN
        \chronos@if@gosodF{border}{\pgfqkeys{/chronos}{border ar=middle ground}}%
        \chronos@if@gosodF{llinell}{\pgfqkeys{/chronos}{llinell ar=middle ground}}%
        \chronos@if@gosodF{llinell amser}{\pgfqkeys{/chronos}{llinell amser ar=main}}%
        \chronos@if@gosodF{cysylltiad}{\pgfqkeys{/chronos}{cysylltiad ar=background}}%
%         \chronos@if@gosodF{@llinell}{\pgfqkeys{/chronos}{llinellau={fill=##1,fill opacity=.25,draw=none}}}%
        \ifdim\chronos@llinell@yshift=\pi pt % rhag: llunio ar y border | default: draw on the border
          \chronos@llinell@yshift=0pt %
        \fi
        \ifchronostimelinearrow
          \chronostimelinearrowfalse
          \PackageWarning{chronos}{A timeline arrow requires a suitable off line style}
        \fi
      \else
        \chronos@if@gosodF{border}{\pgfqkeys{/chronos}{border ar=middle ground}}%
        \chronos@if@gosodF{llinell}{\pgfqkeys{/chronos}{llinell ar=main}}%
        \chronos@if@gosodF{llinell amser}{\pgfqkeys{/chronos}{llinell amser ar=main}}%
        \chronos@if@gosodF{cysylltiad}{\pgfqkeys{/chronos}{cysylltiad ar=background}}%
%         \chronos@if@gosodF{@llinell}{\pgfqkeys{/chronos}{llinellau={draw=##1,draw opacity=.75}}}%
        \ifx\chronos@templlll\chronos@templlplc
          \ifx\chronos@templlll\chronos@templlw
            \colorlet{chronos@lliw@llinell}{chronos@prifliw}%
            \colorlet{chronos@lliw@cefndir@llinell}{chronos@prifliw@cefndir}%
          \fi
        \fi
      \fi
      \providecolor{chronos main colour}{named}{chronos@prifliw}%
      \providecolor{chronos main background colour}{named}{chronos@prifliw@cefndir}%
      \providecolor{chronos main color}{named}{chronos@prifliw}%
      \providecolor{chronos main background color}{named}{chronos@prifliw@cefndir}%
      \providecolor{chronos prifliw}{named}{chronos@prifliw}%
      \providecolor{chronos prifliw cefndir}{named}{chronos@prifliw@cefndir}%
      \providecolor{chronos timeline foreground colour}{named}{chronos@lliw@llinell}%
      \providecolor{chronos timeline background colour}{named}{chronos@lliw@cefndir@llinell}%
      \providecolor{chronos timeline foreground color}{named}{chronos@lliw@llinell}%
      \providecolor{chronos timeline background color}{named}{chronos@lliw@cefndir@llinell}%
      \providecolor{chronos lliw llinell amser blaendir}{named}{chronos@lliw@llinell}%
      \providecolor{chronos lliw llinell amser cefndir}{named}{chronos@lliw@cefndir@llinell}%
      \providecolor{chronos timeline border inner colour}{named}{chronos@borderinner}%
      \providecolor{chronos timeline border outer colour}{named}{chronos@borderouter}%
      \providecolor{chronos timeline border middle colour}{named}{chronos@bordermiddle}%
      \providecolor{chronos timeline border inner color}{named}{chronos@borderinner}%
      \providecolor{chronos timeline border outer color}{named}{chronos@borderouter}%
      \providecolor{chronos timeline border middle color}{named}{chronos@bordermiddle}%
      \providecolor{chronos lliw llinell amser border mewnol}{named}{chronos@borderinner}%
      \providecolor{chronos lliw llinell amser border allanol}{named}{chronos@borderouter}%
      \providecolor{chronos lliw llinell amser border canol}{named}{chronos@bordermiddle}%
      \colorlet{chronos current tag colour}{chronos@prifliw}%
      \colorlet{chronos current tag color}{chronos@prifliw}%
      \ifdim\chronos@height=\pi pt % BEGIN
        \PackageInfo{chronos}{Timeline height unset. Guessing an appropriate value.}%
        \ifchronos@yearsonline 
          \chronos@height=10mm
          \ifdim\chronos@borderheight=\pi pt
            \PackageInfo{chronos}{Timeline border height unset. Guessing an appropriate value.}%
            \chronos@borderheight=2.5mm
          \fi
        \else % off line
          \ifdim\chronos@borderheight=\pi pt
            \PackageInfo{chronos}{Timeline border height unset. Guessing an appropriate value.}%
            \chronos@height=1pt
            \chronos@borderheight=0pt
          \else
            \pgfmathsetlength \chronos@height {4*\chronos@borderheight}%
          \fi
        \fi
      \fi % END \ifdim\chronos@height=\pi pt
      \ifdim\chronos@borderheight=\pi pt % angen height am hwn ; angen hwn am llinell yshift
        \PackageInfo{chronos}{Timeline border height unset. Guessing an appropriate value.}%
        \ifchronos@yearsonline
          \pgfmathsetlength \chronos@borderheight {\chronos@height/4}
        \else
          \chronos@borderheight=0pt
        \fi
      \fi
      \ifchronos@yearsonline % BEGIN \ifchronos@yearsonline
      \else
        \pgfqkeys{/chronos/timeline}{do timeline arrow}%
        \ifdim\chronos@llinell@yshift=\pi pt % BEGIN
          \ifdim\chronos@height<5pt % BEGIN
            \ifdim\chronos@borderheight<.5pt % BEGIN
              \ifchronos@blynyddoeddisod% BEGIN
                \chronos@llinell@yshift=5pt
              \else
                \ifchronos@blynyddoedduchod% BEGIN
                  \chronos@llinell@yshift=-5pt
                \fi % END \ifchronos@blynyddoedduchod
              \fi % END \ifchronos@blynyddoeddisod
            \else
              \ifchronos@blynyddoeddisod % BEGIN
                \chronos@llinell@yshift=\chronos@borderheight
              \else
                \ifchronos@blynyddoedduchod % BEGIN
                  \chronos@llinell@yshift=-\chronos@borderheight
                \fi % END \ifchronos@blynyddoedduchod
              \fi % END % \ifchronos@blynyddoeddisod
            \fi % END \ifdim\chronos@borderheight<.5pt
          \else
            \ifchronos@blynyddoeddisod % BEGIN
              \chronos@llinell@yshift=2pt
            \else
              \ifchronos@blynyddoedduchod % BEGIN
                \chronos@llinell@yshift=-2pt
              \fi % END \ifchronos@blynyddoedduchod
            \fi % END  \ifchronos@blynyddoeddisod
          \fi % END \ifdim\chronos@height<5pt 
        \fi % END \ifdim\chronos@llinell@yshift=\pi pt
      \fi % END ifchronos@yearsonline
      \ifx\chronos@templlpl\chronos@templlplc \PackageWarning{chronos}{You've set the main colour and the main background colour to the same.}\fi
      \ifnum\chronos@startyear=0\relax
        \chronos@yearzerotrue
      \else
        \ifnum\chronos@endyear=0\relax
          \chronos@yearzerotrue
        \fi
      \fi
      \IfExistT \chronos@camrhaniadau {\chronos@if@gosodF{@bare}{%
          \ifnum\chronos@camrhaniadau>1
            \chronos@marks@baretrue
          \fi
        }%
      }%
      \setlength\chronos@diwedd@diwedd{0pt}%
      \setlength\chronos@dechrau@dechrau{0pt}%
      \chronos@if@gosodF{markeras}{%
        \ifnum\chronos@startyear<0
          \ifnum\chronos@endyear>0
            \chronos@markerastrue
          \fi
        \fi
      }% \chronos@if@gosodF{markeras}
      \ifchronos@markeras % BEGIN
        % angen côd Martin Scharrer uchod
        \ifnum\chronos@endyear>0 % Rmano: https://chat.stackexchange.com/transcript/message/64273912#64273912
          \settowidth\chronos@diwedd@diwedd{\chronos@ffont@cyfnodau\chronos@ce}%
          \addtolength{\chronos@diwedd@diwedd}{\chronos@eramargin}%
        \else
          \let\chronos@ce\relax
        \fi
        \ifnum\chronos@startyear<0 % Rmano: https://chat.stackexchange.com/transcript/message/64273912#64273912
          \settowidth\chronos@dechrau@dechrau{\chronos@ffont@cyfnodau\chronos@bce}%
          \addtolength{\chronos@dechrau@dechrau}{\chronos@eramargin}%
        \else
          \let\chronos@bce\relax
        \fi
      \fi % END \ifchronos@markeras
%       \ifchronos@yearsonline
%         {% rhag ofn rhywun wedi gosod line width gwahanol | in case somebody's set a different line width
%           % use a group to avoid setting timeline style globally
%           \pgfqkeys{/pgf}{key filters/defined/.install key filter}%
%           \pgfkeysfiltered{/chronos/llinell amser/timeline@line}%
%           % so we need to take the line width out in a global dimen
%           \global\chronos@tmpdimenb=\pgflinewidth
%         }% & adjust the timeline width accordingly
%         \advance \chronos@width by -\chronos@tmpdimenb
%       \fi
      % cofia!! \chronos@set@date a ffrindiau'n awto-cywiro am flwyddyn sero!!
      % cofia! ti'n defnyddio **pgfcalendar** yn lle blynyddoedd nawr!!
      \pgfmathsetmacro\chronos@unit{(\chronos@width-2*\chronos@timelinemargin-\chronos@dechrau@dechrau-\chronos@diwedd@diwedd)/(\thechronos@enddate-\thechronos@startdate)}%
  %     \chronos@timelineunitlength \dimexpr\chronos@unit pt\relax% using this truncates the dimension and leads to visible inaccuracies e.g. 0.0003pt vs. 0.00031~pt makes a difference over 5,000 units or so!
      \pgfmathsetmacro{\chronos@amser@diwedd}{(\thechronos@enddate-\thechronos@startdate)*\chronos@unit}%
      \addtolength{\chronos@dechrau@dechrau}{\chronos@timelinemargin}%
      \addtolength{\chronos@diwedd@diwedd}{\chronos@timelinemargin}%
      \path (0pt,0pt) ++(-\chronos@dechrau@dechrau,0pt) coordinate (chronos pre);% oedd chronos@dechrau
      \path (\chronos@amser@diwedd pt,0pt) ++(\chronos@diwedd@diwedd,0pt) coordinate (chronos post);% oedd chronos@diwedd
      \chronos@inner@halfheight \dimexpr0.5\dimexpr\chronos@height\relax%
      \chronos@outer@halfheight \dimexpr\chronos@inner@halfheight+\dimexpr\chronos@borderheight\relax%
      \coordinate (chronos top) at (0pt,\chronos@inner@halfheight);% oedd chronos@height
      \coordinate (chronos base) at (0pt,-\chronos@inner@halfheight);% oedd chronos@depth
      \coordinate (chronos foot) at (0pt,-\chronos@outer@halfheight);
      \coordinate (chronos head) at (0pt,\chronos@outer@halfheight);
      % chronos pre-top, chronos post-top, chronos pre-base, chronos post-base
      \foreach \i/\j in {pre/top,post/top,pre/base,post/base,pre/head,post/head,pre/foot,post/foot} \coordinate (chronos \i-\j) at (chronos \i |- chronos \j);
      \coordinate (chronos start) at (0pt,0pt);% dal yn gywir?
      \coordinate (chronos origin) at (chronos start);% newid isod efaillai
      \coordinate (chronos end) at (\chronos@amser@diwedd pt,0pt);
      \coordinate (chronos mid) at ($(chronos pre)!.5!(chronos post)$);
      \coordinate (chronos mid-time) at ($(chronos start)!.5!(chronos end)$);
      % styles which rotate labels need this earlier; reset here in case altered
      \let\timelineht\chronos@height
      \begin{scope}[/chronos/chronos@border@haenen]
        \ifdim\chronos@borderheight>0pt
          \path [top color=chronos@borderouter, bottom color=chronos@borderinner, middle color=chronos@bordermiddle, /chronos/llinell amser/timeline@border] (chronos pre-top) rectangle (chronos post-head);
          \path [bottom color=chronos@borderouter, top color=chronos@borderinner, middle color=chronos@bordermiddle, /chronos/llinell amser/timeline@border] (chronos post-base) rectangle (chronos pre-foot);
        \fi
      \end{scope}% [/chronos/chronos@border@haenen]
      \begin{scope}[/chronos/chronos@llinell amser@haenen]
        \ifchronos@yearsonline
          % fill the timeline if putting the years etc. onto it
          \fill [chronos@lliw@cefndir@llinell,/chronos/llinell amser/timeline@line] (chronos pre-top) rectangle (chronos post-base);
%           \draw [chronos@lliw@cefndir@llinell,/chronos/llinell amser/timeline@line] (chronos pre-top) -- (chronos post-top) (chronos post-base) -- (chronos pre-base);
        \else
          % fel arall, draw
          \draw [chronos@lliw@llinell,line width=\chronos@height,/chronos/llinell amser/timeline@line] (chronos pre) -- (chronos post);
          % gweler ateb Qrrbrbirlbel: https://tex.stackexchange.com/a/701524/ i fy nghwestiwn: https://tex.stackexchange.com/q/701518/
          \coordinate (tmpa) at (current bounding box.north);
          \coordinate (tmpb) at (current bounding box.south);
          \pgfresetboundingbox
          \path (chronos pre) -- (chronos post) -- (tmpa) -- (tmpb);
        \fi % \ifchronos@yearsonline
        % prif label
        % lau cyfnodau
        \ifchronos@markeras % BEGIN
          \ifchronos@yearsonline
            \node (chronos bce) [text=chronos@lliw@llinell, font=\chronos@ffont@cyfnodau, inner xsep=0pt, xshift=-\chronos@eramargin, anchor=east] at (chronos start) {\chronos@bce};
            \node (chronos ce) [text=chronos@lliw@llinell, font=\chronos@ffont@cyfnodau, inner xsep=0pt, xshift=\chronos@eramargin, anchor=west] at (chronos end) {\chronos@ce};
          \else 
            \settowidth \chronos@templgthc {\chronos@ffont@cyfnodau\chronos@bce}%
            \node (chronos bce) [/chronos/llinell amser/timeline@years, /chronos/llinell amser/timeline@year@off@line, text=chronos@lliw@llinell, font=\chronos@ffont@cyfnodau, inner xsep=0pt, xshift=-\chronos@eramargin-.5\chronos@templgthc] at (chronos start) {\chronos@bce};
            \settowidth \chronos@templgthc {\chronos@ffont@cyfnodau\chronos@ce}%
            \node (chronos ce) [/chronos/llinell amser/timeline@years, /chronos/llinell amser/timeline@year@off@line, text=chronos@lliw@llinell, font=\chronos@ffont@cyfnodau, inner xsep=0pt, xshift=\chronos@eramargin+.5\chronos@templgthc] at (chronos end) {\chronos@ce};
          \fi
        \fi % END \ifchronos@markeras
        \ifchronos@timeline@showyears % BEGIN
          \pgfmathsetcounter{chronos@startyear}{\chronos@startyear}%
          \pgfmathsetcounter{chronos@startmarkyear}{\chronos@startyear}%
          \pgfmathsetcounter{chronos@endyear}{\chronos@endyear}%
          \def\tempa{none}%
          \setcounter{chronos@tempcnta}{\value{chronos@endyear}}%
          \stepcounter{chronos@tempcnta}%
          \addtocounter{chronos@tempcnta}{-\value{chronos@startyear}}%
          \IfExistTF \chronos@cam@blwyddyn@fawr {%
            \IfExistTF \chronos@cam@blwyddyn@fach {%
              \ifnum\chronos@cam@blwyddyn@fach>\chronos@cam@blwyddyn@fawr
                \def\chronos@cam@blwyddyn@fach{0}%
                \PackageWarning{chronos}{Setting minor step year to zero}%
              \else
                \IfBooleanExprT {%
                  (\IntCompareBoolean {\chronos@cam@blwyddyn@fach} > {0}) && ! (\LegacyBoolean {chronos@minoryears}) && ! (\LegacyBoolean {chronos@marks@minor}) && (\LegacyBoolean {chronos@marks@bare})
                }{%
                  \PackageWarning{chronos}{Setting minor step year to zero so your marks are evenly spaced}%
                  \def\chronos@cam@blwyddyn@fach{0}%
                }%
              \fi
            }{\def\chronos@cam@blwyddyn@fach{0}}%
          }{%
            \IfExistTF \chronos@cam@blwyddyn@fach {%
              \let\chronos@cam@blwyddyn@fawr\chronos@cam@blwyddyn@fach
              \def\chronos@cam@blwyddyn@fach{0}%
              \PackageWarning{chronos}{Using minor step year as step year and setting minor step year to zero}%
            }{% 
              \PackageWarning{chronos}{You have not specified how frequently years should be marked on the timeline. Guessing appropriate values. Set step major year and/or step minor year to specify}%
              \ifnum\value{chronos@tempcnta}>1500
                \def\chronos@cam@blwyddyn@fawr{500}%
                \def\chronos@cam@blwyddyn@fach{100}%
                \else\ifnum\value{chronos@tempcnta}>1000
                  \def\chronos@cam@blwyddyn@fawr{250}%
                  \def\chronos@cam@blwyddyn@fach{50}%
                  \else\ifnum\value{chronos@tempcnta}>300
                    \def\chronos@cam@blwyddyn@fawr{100}%
                    \def\chronos@cam@blwyddyn@fach{50}%
                    \else\ifnum\value{chronos@tempcnta}>150
                      \def\chronos@cam@blwyddyn@fawr{100}%
                      \def\chronos@cam@blwyddyn@fach{25}%
                      \else\ifnum\value{chronos@tempcnta}>100
                        \def\chronos@cam@blwyddyn@fawr{50}%
                        \def\chronos@cam@blwyddyn@fach{10}%
                        \else\ifnum\value{chronos@tempcnta}>50
                          \def\chronos@cam@blwyddyn@fawr{20}%
                          \def\chronos@cam@blwyddyn@fach{10}%
                          \else\ifnum\value{chronos@tempcnta}>20
                            \def\chronos@cam@blwyddyn@fawr{10}%
                            \def\chronos@cam@blwyddyn@fach{2}%
                            \else\ifnum\value{chronos@tempcnta}>10
                              \def\chronos@cam@blwyddyn@fawr{5}%
                              \def\chronos@cam@blwyddyn@fach{1}%
                              \else\def\chronos@cam@blwyddyn@fawr{1}%
                              \def\chronos@cam@blwyddyn@fach{0}%
                            \fi % >10
                          \fi % >20
                        \fi % >50
                      \fi % > 100
                    \fi % > 150
                  \fi % >300
                \fi % >1000
              \fi % >1500
            }%
          }% \IfExistTF \chronos@cam@blwyddyn@fawr
          \chronos@if@gosodF{markateraswitch}{%
            \ifnum\chronos@cam@blwyddyn@fach=1
              \chronos@markateraswitchfalse
            \else
              \ifnum\chronos@cam@blwyddyn@fawr=1
                \chronos@markateraswitchfalse
              \else
                \chronos@markateraswitchtrue
              \fi
            \fi
          }%
          \ifnum\chronos@cam@blwyddyn@fach=0 \let\chronos@tempv\chronos@cam@blwyddyn@fawr \else \let\chronos@tempv\chronos@cam@blwyddyn@fach \fi
          \IfExistF \chronos@camrhaniadau {% rhaid \chronos@marks@baretrue o achos y côd uchod
            \ifnum\value{chronos@tempcnta}<5
              \chronos@marks@baretrue
              \PackageInfo{chronos}{I'm guessing you want bare marks on your timeline. If I'm wrong, specify step divisions=0 to override my decision}%
              \ifnum\value{chronos@tempcnta}>2
                \def\chronos@camrhaniadau{4}%
              \else
                \ifnum\value{chronos@tempcnta}>1
                  \def\chronos@camrhaniadau{6}%
                \else
                  \def\chronos@camrhaniadau{12}%
                \fi % >1
              \fi % >2
            \else
              \ifchronos@marks@bare\relax
              \else
                \chronos@marks@barefalse
                \PackageInfo{chronos}{I'm guessing you don't want bare marks on your timeline. If I'm wrong, specify step divisions to override my decision}%
              \fi
            \fi % <5
          }% \chronos@camrhaniadau
          \ifchronos@marks@bare
            \IfExistF \chronos@camrhaniadau {%
              \PackageInfo{chronos}{You have requested bare marks but not specified how many. Guessing 4 per minor step. Set step divisions to specify}%
              \def\chronos@camrhaniadau{4}%
            }% \IfExistT \chronos@camrhaniadau
          \fi % \ifchronos@marks@bare
          \IfFreeTF \chronos@stepfrom {%
            \ifnum\thechronos@startyear=\thechronos@endyear
            \else
              \def\tempa{01}%
              \ifx\chronos@startmonth\tempa
                \ifx\chronos@startday\tempa
                \else
                  \stepcounter{chronos@startmarkyear}%
                \fi % \ifx\chronos@startday\tempa
              \else
                \stepcounter{chronos@startmarkyear}%
              \fi % \ifx\chronos@startmonth\tempa
            \fi % \ifnum\thechronos@startyear=\thechronos@endyear
            \pgfmathsetmacro\chronos@tempremainder{int(mod(\thechronos@startmarkyear,\chronos@tempv))}%
            \ifnum\chronos@tempremainder=0\relax
            \else
              \IfBooleanExprTF { ! (\LegacyBoolean{chronos@yearzero}) && (\IntCompareBoolean{\thechronos@startmarkyear}{=}{1}) }{%
                \setcounter{chronos@startmarkyear}{0}% => 1 fel chronos@startmarkyear
              }{%
                \ifnum\chronos@tempremainder<0
                  \pgfmathsetcounter{chronos@startmarkyear}{int(\thechronos@startmarkyear-\chronos@tempremainder)}%
                \else
                  \pgfmathparse{int(\thechronos@startmarkyear-\chronos@tempremainder+\chronos@tempv)}%
                  \ifnum\pgfmathresult>\thechronos@endyear
                    \PackageWarning{chronos}{Ignoring steps}%
                  \else
                    \setcounter{chronos@startmarkyear}{\pgfmathresult}%
                  \fi
                \fi
              }%
            \fi
          }{%
            \pgfmathsetcounter{chronos@startmarkyear}{\chronos@stepfrom}%
            \pgfmathparse{int(mod(\thechronos@startmarkyear,\chronos@tempv))}%
            \ifnum\pgfmathresult=0\relax
            \else
              \PackageWarning{chronos}{You have explicitly requested years marked on your timeline which are not modulo the steps you have specified. I'm setting the year format to show full years, which should make the result a bit more intelligible.}%
              \chronos@setminoryearformat{!Y}%
            \fi
          }% \IfFreeTF \chronos@stepfrom
          \ifnum\chronos@cam@blwyddyn@fach=0
            \pgfmathsetmacro\chronos@nextstep{int(((\thechronos@startmarkyear+\chronos@cam@blwyddyn@fawr)>\thechronos@endyear) ? \thechronos@endyear : (\thechronos@startmarkyear+\chronos@cam@blwyddyn@fawr))}%
          \else
            \pgfmathsetmacro\chronos@nextstep{int(((\thechronos@startmarkyear+\chronos@cam@blwyddyn@fach)>\thechronos@endyear) ? \thechronos@endyear : (\thechronos@startmarkyear+\chronos@cam@blwyddyn@fach))}%
          \fi
          \chronos@global@clear@to@clist{tmpa}{}%
          \IfExistT \chronos@camrhaniadau {\pgfmathsetmacro \chronos@tempml{int(\chronos@camrhaniadau-1)}}%
          \ifchronos@yearzero\setcounter{chronos@tempcnta}{1}\else\setcounter{chronos@tempcnta}{0}\fi
          \IfBooleanExprTF {%
             (\IntCompareBoolean{\chronos@nextstep}{=}{\thechronos@startmarkyear}) || !  (\IntCompareBoolean{\chronos@nextstep}{<}{\thechronos@endyear}) || ( (  (\IntCompareBoolean{\chronos@nextstep}{=}{0}) ||  (\IntCompareBoolean{\thechronos@startmarkyear}{=}{0}) ) &&  (\IntCompareBoolean{\thechronos@startmarkyear}{<}{-\thechronos@endyear}) && ! \LegacyBoolean {chronos@yearzero} )
          }{% osgoi infinite loop yn pgf \foreach isod
            \setcounter{chronos@tempcntb}{\thechronos@endyear}\addtocounter{chronos@tempcntb}{-\thechronos@startyear}%
            \IfBooleanExprT {%
              ! \LegacyBoolean {chronos@yearzero} &&  (\IntCompareBoolean{\thechronos@startmarkyear}{>}{-\thechronos@endyear}) &&   (  (\IntCompareBoolean{\chronos@nextstep}{=}{0}) ||  (\IntCompareBoolean{\thechronos@startmarkyear}{=}{0}) )
            } {\addtocounter{chronos@tempcntb}{-1}}%
            \ifnum\thechronos@tempcntb<2
              \IfExistTF \chronos@camrhaniadau 
              {%
                \pgfmathparse{int(mod(12,\chronos@camrhaniadau))}%
                \ifnum\pgfmathresult=0\relax
                \else
                  \PackageWarning{Since your timeline spans fewer than two years, step divisions must be a factor of 12. I will use 4 if you requested 5 and 6 otherwise}%
                  \ifnum\pgfmathresult=5
                    \def\chronos@camrhaniadau{4}%
                  \else
                    \ifnum\pgfmathresult>6
                      \def\chronos@camrhaniadau{6}%
                    \fi % \fnum\pgfmathresult>6 hynny yw 7,8,9,10,11
                  \fi % \ifnum\pgfmathresult=5
                \fi % \ifnum\pgfmathresult=0
                \setcounter{chronos@tempcntb}{\chronos@startmonth}%
                \ifnum\chronos@startday>1 \stepcounter{chronos@tempcntb}\fi
                \edef\chronos@tmpstartmonth{\thechronos@tempcntb}%
                \IfBooleanExprF {%
                  (\IntCompareBoolean{\chronos@tmpstartmonth}{=}{\chronos@endmonth}) && (\IntCompareBoolean{\thechronos@startyear}{=}{\thechronos@endyear})
                }
                {%
                  \pgfmathsetcounter{chronos@tempcntc}{int{12/\chronos@camrhaniadau}}%
                  \addtocounter{chronos@tempcntb}{\thechronos@tempcntc}%
                  \ifnum\thechronos@tempcntb>11
                    \edef\chronos@tempu{\chronos@tmpstartmonth,12}%
                  \else
                    \edef\chronos@tempu{\chronos@tmpstartmonth,\thechronos@tempcntb,...,12}%
                  \fi
                  \foreach \m [expand list] in {\chronos@tempu}%
                  {%
                    \chronos@set@date {\thechronos@startyear}{\m}{01}{tempa}%
                    \ifnum\thechronos@tempadate>\thechronos@enddate
                      \breakforeach
                    \else
                      \ifnum\m=1
                        \chronos@global@to@clist*+{tmpa}{\thechronos@tempadate/\thechronos@startyear/\thechronos@startyear}%
                      \else
                        \chronos@global@to@clist*+{tmpa}{\thechronos@tempadate/-5000/\thechronos@startyear}%
                      \fi % \m=1
                    \fi % \thechronos@tempadate>\thechronos@enddate
                  }% \foreach \m in {\chronos@tmpstartmonth,...,12}
                  \ifnum\thechronos@startyear<\thechronos@endyear
                    \stepcounter{chronos@tempcntc}%
                    \ifnum\thechronos@tempcntc<\chronos@endmonth
                      \edef\chronos@tempu{1,\thechronos@tempcntc,...,\chronos@endmonth}%
                    \else
                      \edef\chronos@tempu{1,\thechronos@tempcntc}%
                    \fi
                    \foreach \m [expand list] in {\chronos@tempu} % {1,...,\chronos@endmonth}
                    {%
                      \chronos@set@date {\thechronos@endyear}{\m}{01}{tempa}% awto-cywiro am flwyddyn sero
                      \ifnum\thechronos@tempadate>\thechronos@enddate
                        \breakforeach
                      \else
                        \ifnum\m=1
                          \chronos@global@to@clist*+{tmpa}{\thechronos@tempadate/\thechronos@endyear/\thechronos@endyear}%
                        \else
                          \chronos@global@to@clist*+{tmpa}{\thechronos@tempadate/-5000/\thechronos@endyear}%
                        \fi % \m=1
                      \fi % \thechronos@tempadate>\thechronos@enddate
                    }% \foreach \m in {1,...,\chronos@endmonth}
                  \fi % \thechronos@startyear<\thechronos@endyear
                  }% \ifboolexpr { test {\ifnum\thechronos@tmpstartmonth=\thechronos@endmonth} and test {\ifnum\thechronos@startyear=\thechronos@endyear} }
              }{% \IfExistTF \chronos@camrhaniadau F
                \chronos@global@to@clist*+{tmpa}{\thechronos@startdate/\thechronos@startmarkyear/\thechronos@startmarkyear,\thechronos@enddate/\thechronos@endyear/\thechronos@endyear}%
              }% \IfExistTF \chronos@camrhaniadau
              \chronos@marks@barefalse
            \else
              \foreach \b [evaluate=\b as \i using {((\b==0)&&(\thechronos@tempcnta==0)) ? 1 : int(\b)}] in {\thechronos@startmarkyear,\thechronos@endyear} {%
                \chronos@set@date{\i}{01}{01}{year}% awto-cywiro am flwyddyn sero
                \chronos@global@to@clist*+{tmpa}{\thechronos@yeardate/\b/\i}%
              }% 
            \fi % \ifnum\thechronos@tempcntb<2
          }{%
            \foreach \b [evaluate=\b as \i using {((\b==0)&&(\thechronos@tempcnta==0)) ? 1 : int(\b)}] in {\thechronos@startmarkyear,\chronos@nextstep,...,\thechronos@endyear} {%
              \chronos@set@date{\i}{01}{01}{year}% awto-cywiro am flwyddyn sero
              \chronos@global@to@clist*+{tmpa}{\thechronos@yeardate/\b/\i}%
            }% 
          }% \ifboolexpr { test {\ifnumcomp{\chronos@nextstep}{=}{\thechronos@startyear}} or test {\ifnumcomp{\chronos@nextstep}{=}{\thechronos@endyear}} }
%           \IfFreeF \bagpuss { \show\chronos@camrhaniadau \ifchronos@marks@bare\show\mebare\else\show\meclothed\fi \chronosshowpreset}
          \foreach \d/\b/\chronosyeari [expand list, remember=\chronosyeari as \ilast (initially \pi), remember=\d as \dlast (initially \pi)] in {\chronos@global@from@clist{tmpa}}
          {% BEGIN \foreach \b ...
            \ifnum\d=\dlast\relax % BEGIN
            \else
              \pgfmathsetmacro\chronos@tempa{(\d-\thechronos@startdate)*\chronos@unit}%
              \coordinate (chronos date \d) at (\chronos@tempa pt,0pt);
              \pgfqkeys{/chronos}{% defnyddio am nodau noeth beth bynnag ac am marciau cyffredinol os y llinell amser yn fyr
                temp@on/.style={/chronos/llinell amser/timeline@minor@mark@on@line},
                temp@off/.style={/chronos/llinell amser/timeline@minor@mark@off@line},
              }%    
              \ifnum\dlast=\pi
                \let\chronos@tempff\chronos@ffont@camaubach
                \ifchronos@yearsonline
                \node (chronos phantom year) [rotate around/.style={}, rotate/.style={}, /chronos/llinell amser/timeline@years, /chronos/llinell amser/timeline@year@on@line, font=\chronos@tempff] at (chronos start) {\phantom{1}};
                \else
                \node (chronos phantom year) [rotate around/.style={}, rotate/.style={}, /chronos/llinell amser/timeline@years, /chronos/llinell amser/timeline@year@off@line, font=\chronos@tempff, fill=none] at (chronos start) {\phantom{\chronos@showyear[\chronos@minoryearformat]{1}}};
                \fi
              \fi % \ifnum\dlast=\pi
              \ifnum\b=-5000
                \ifchronos@yearsonline
                  \path [/chronos/temp@on] (chronos phantom year.south -| chronos date \d) -- (chronos phantom year.north -| chronos date \d);
                \else
                  \path [/chronos/temp@off] (chronos date \d)  -- ( chronos date \d |- chronos phantom year.\chronos@timelineyearsanchor) ;
                \fi
              \else % \ifnum\b=-5000
                \coordinate (chronos year \chronosyeari) at (\chronos@tempa pt,0pt);
                \ifnum\b=\thechronos@startmarkyear 
                  \xdef\chronos@firstmarkedyeardate{\d}%
                  \coordinate (chronos first marked year) at (chronos year \chronosyeari);
                  \ifnum\chronosyeari=0
                    \coordinate (chronos origin) at (\chronos@tempa pt,0pt);
                  \fi
                \else
                  \ifnum\chronosyeari=1
                    \ifchronos@yearzero\relax
                    \else
                      \coordinate (chronos origin) at (\chronos@tempa pt,0pt);
                      \coordinate (chronos year 0) at (chronos year 1);% make \foreach loops work straightforwardly (not used in main code)
                    \fi % \ifchronos@yearzero
                  \fi % \ifnum\chronosyeari=1
                \fi % \ifnum\b=\thechronos@startmarkyear
                \ifnum\b=\chronos@nextstep
                  \ifchronos@marks@bare
                    \pgfmathsetmacro\chronos@tempg{((\d-\chronos@firstmarkedyeardate)*\chronos@unit)/\chronos@camrhaniadau}%
                    \global\let\chronos@tempg\chronos@tempg
                  \fi
                \fi % \ifnum\b=\chronos@nextstep
                \ifnum\chronos@cam@blwyddyn@fach=0
                  \chronos@cam@modtrue
                \else
                  \pgfmathparse{int(mod(\chronosyeari,\chronos@cam@blwyddyn@fawr))}%
                  \ifnum\pgfmathresult=0\relax
                    \chronos@cam@modtrue
                  \else
                    \IfBooleanExprT {%
                      ! \LegacyBoolean {chronos@yearzero} && \IntCompareBoolean {\chronosyeari}={1}
                    }{%
                      \pgfmathparse{int(mod((\chronosyeari-1),\chronos@cam@blwyddyn@fawr))}%
                      \ifnum\pgfmathresult=0\relax
                        \chronos@cam@modtrue
                      \fi
                    }%
                  \fi % \ifnum\pgfmathresult=0
                \fi % \ifnum\chronos@cam@blwyddyn@fach=0
                \ifchronos@cam@mod
                  \pgfqkeys{/chronos}{%
                    temp@on/.style={/chronos/llinell amser/timeline@mark@on@line},
                    temp@off/.style={/chronos/llinell amser/timeline@mark@off@line},
                  }%
                  \let\chronos@tempff\chronos@ffont@camaumawr
                  \def\chronos@temph{}%
                \else
                  \pgfqkeys{/chronos}{%
                    temp@on/.style={/chronos/llinell amser/timeline@minor@mark@on@line},
                    temp@off/.style={/chronos/llinell amser/timeline@minor@mark@off@line},
                  }%
                  \let\chronos@tempff\chronos@ffont@camaubach
                  \xdef\chronos@temph{\chronos@minoryearformat}%
                  \ifchronos@marks@minor\chronos@markstrue\else\chronos@marksfalse\fi
                \fi % \ifchronos@cam@mod
                \ifchronos@markateraswitch % \ifchronos@temp tracks whether we draw a node (T) or coordinate (F)
                  \ifnum\b=0 
                    \chronos@tempfalse
                  \else 
                    \chronos@temptrue 
                  \fi
                  \ifchronos@minoryears \else \ifchronos@cam@mod \else \chronos@tempfalse \fi\fi
                \else 
                  \chronos@temptrue
                \fi
                \ifchronos@yearsonline % BEGIN ifchronos@yearsonline
                  \ifchronos@temp % BEGIN if labelling era switch or not switching here, use a node
                    \node (chronos year \chronosyeari) [/chronos/llinell amser/timeline@years, /chronos/llinell amser/timeline@year@on@line, font=\chronos@tempff] at (chronos year \chronosyeari) {\chronos@showyear[\chronos@temph]{\chronosyeari}};
                  \fi % END \ifchronos@temp
                  \ifchronos@marks % BEGIN
                    \path [/chronos/temp@on] (chronos year \chronosyeari.south) -- (chronos year \chronosyeari |- chronos base);% rhag ofn rotate (pwy sy'n gwybod?)
                    \path [/chronos/temp@on] (chronos year \chronosyeari.north) --  (chronos year \chronosyeari |- chronos top);% rhag ofn rotate (pwy sy'n gwybod?)
                    \ifchronos@marks@bare % BEGIN
                      \ifnum\dlast=\pi\relax % BEGIN
                      \else
                        \ifnum\chronos@camrhaniadau>1 % BEGIN
                          \foreach \m [evaluate=\m as \n using {int(\m-1)}] in {2,...,\chronos@camrhaniadau}
                          {%
                            \path [/chronos/llinell amser/timeline@bare@mark@on@line] ([xshift={-\n*\chronos@tempg pt}]chronos year \chronosyeari |- chronos phantom year.south) -- ([xshift={-\n*\chronos@tempg pt}]chronos year \chronosyeari |- chronos phantom year.north);
                          }%
                          \ifnum\b=\chronos@nextstep % BEGIN
                            \path (chronos year \ilast);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \setlength \chronos@templgtha{\chronos@tempgx-\chronos@tempg pt}%
                            \ifdim\chronos@templgtha<0pt\relax % BEGIN
                            \else
                              \foreach \n in {1,...,\chronos@tempml}
                              {%
                                \coordinate (a) at (\chronos@templgtha,0pt);
                                \path [/chronos/llinell amser/timeline@bare@mark@on@line]  (a |- chronos phantom year.south) -- (a |- chronos phantom year.north);
                                \addtolength \chronos@templgtha{-\chronos@tempg pt}%
                                \ifdim\chronos@templgtha<0pt 
                                  \breakforeach
                                \fi
                                \global\chronos@templgtha\chronos@templgtha
                              }%
                            \fi % END \ifdim\chronos@templgtha<0pt
                          \fi % END \ifnum\b=\chronos@nextstep
                          \edef\chronos@tempey{\thechronos@endyear}%
                          \pgfmathsetmacro\chronos@tempny{int(\b+\chronos@tempv)}%
                          \ifnum\chronos@tempny>\thechronos@endyear % BEGIN
                            \path (chronos year \chronosyeari);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \setlength \chronos@templgtha{\chronos@tempgx+\chronos@tempg pt}%
                            \path (chronos end);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \ifdim\chronos@templgtha>\chronos@tempgx\relax % BEGIN
                            \else
                              \foreach \n in {1,...,\chronos@tempml}
                              {%
                                \coordinate (a) at (\chronos@templgtha,0pt);
                                \path [/chronos/llinell amser/timeline@bare@mark@on@line]  (a |- chronos phantom year.south) -- (a |- chronos phantom year.north);
                                \addtolength \chronos@templgtha{\chronos@tempg pt}%
                                \ifdim\chronos@templgtha>\chronos@tempgx 
                                  \breakforeach
                                \fi
                                \global\chronos@templgtha\chronos@templgtha
                              }%
                            \fi % END \ifdim\chronos@templgtha<0pt                        
                          \fi % END \ifnum\chronos@tempny>\thechronos@endyear
                        \fi % END \ifnum\chronos@camrhaniadau>1
                      \fi % END \ifnum\dlast=\pi
                    \fi % END \ifchronos@marks@bare
                  \fi % END \ifchronos@marks
                \else % chronos@yearsonline yw F
                  \ifchronos@temp % BEGIN if labelling era switch or not switching here, use a node
                    \node (chronos node year \chronosyeari) [/chronos/llinell amser/timeline@years, /chronos/llinell amser/timeline@year@off@line, font=\chronos@tempff] at (chronos year \chronosyeari) {\chronos@showyear[\chronos@temph]{\chronosyeari}};
                  \else
                    \node (chronos node year \chronosyeari) [/chronos/llinell amser/timeline@years, /chronos/llinell amser/timeline@year@off@line, font=\chronos@ffont@camaumawr, draw=none, fill=none] at (chronos year \chronosyeari) {\phantom{\chronos@showyear[\chronos@temph]{\chronosyeari}}};
                  \fi % END % \ifchronos@temp
                  \ifchronos@marks % BEGIN 
                    \ifchronos@temp
                    \else
                      \ifnum\b=0
                        \path [shorten <=.5*\chronos@height, /chronos/temp@off, /chronos/llinell amser/era switch off line] (\chronos@tempa pt,0pt)  -- (chronos node year \chronosyeari.center -| chronos year \chronosyeari) ;% rhag ofn rotate
                        \chronos@temptrue
                      \fi
                    \fi
                      \path [shorten <=.5*\chronos@height, /chronos/temp@off] (\chronos@tempa pt,0pt)  -- (chronos node year \chronosyeari.\chronos@timelineyearsanchor -| chronos year \chronosyeari) ;
                    \ifnum\dlast=\pi\relax
                    \else
                      \ifchronos@marks@bare % BEGIN
                        \ifnum\chronos@camrhaniadau>1
                          \foreach \m  [evaluate=\m as \n using {int(\m-1)}] in {2,...,\chronos@camrhaniadau}
                            \path [shorten <=.5*\chronos@height, /chronos/llinell amser/timeline@bare@mark@off@line] ([xshift={-\n*\chronos@tempg pt}]\chronos@tempa pt,0pt) coordinate (\chronosyeari-\n) -- (\chronosyeari-\n |- chronos node year \chronosyeari.\chronos@timelineyearsanchor);
                          \ifnum\b=\chronos@nextstep % BEGIN
                            \path (chronos year \ilast);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \setlength \chronos@templgtha{\chronos@tempgx-\chronos@tempg pt}%
                            \ifdim\chronos@templgtha<0pt\relax % BEGIN
                            \else
                              \foreach \n in {1,...,\chronos@tempml}
                              {%
                                \path [shorten <=.5*\chronos@height, /chronos/llinell amser/timeline@bare@mark@off@line] (\chronos@templgtha,0pt) coordinate (a) -- (a |- chronos node year \chronosyeari.\chronos@timelineyearsanchor);
                                \addtolength \chronos@templgtha{-\chronos@tempg pt}%
                                \ifdim\chronos@templgtha<0pt \breakforeach\fi
                                \global\chronos@templgtha\chronos@templgtha
                              }%
                            \fi % \ifdim\chronos@templgtha<0pt
                          \fi % \ifnum\b=\chronos@nextstep
                          \edef\chronos@tempey{\thechronos@endyear}%
                          \pgfmathsetmacro\chronos@tempny{int(\b+\chronos@tempv)}%
                          \ifnum\chronos@tempny>\thechronos@endyear % BEGIN
                            \path (chronos year \chronosyeari);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \setlength \chronos@templgtha{\chronos@tempgx+\chronos@tempg pt}%
                            \path (chronos end);
                            \pgfgetlastxy{\chronos@tempgx}{\chronos@tempgy}%
                            \ifdim\chronos@templgtha>\chronos@tempgx\relax % BEGIN
                            \else
                              \foreach \n in {1,...,\chronos@tempml}
                              {%
                                \path [shorten <=.5*\chronos@height, /chronos/llinell amser/timeline@bare@mark@off@line,magenta] (\chronos@templgtha,0pt) coordinate (a) -- (a |- chronos node year \chronosyeari.\chronos@timelineyearsanchor);
                                \addtolength \chronos@templgtha{\chronos@tempg pt}%
                                \ifdim\chronos@templgtha>\chronos@tempgx \breakforeach\fi
                                \global\chronos@templgtha\chronos@templgtha
                              }%
                            \fi % END \ifdim\chronos@templgtha<0pt                        
                          \fi % END \ifnum\b=\thechronos@endyear
                        \fi % END \ifnum\chronos@camrhaniadau>1below
                      \fi % END \ifchronos@marks@bare
                    \fi % END  \ifnum\dlast=\pi
                  \fi % END \ifchronos@marks
                \fi % END years on line
              \fi % \ifnum\b=-5000
            \fi % \ifnum\d=\dlast % END
          }% END \foreach \b ...
        \fi % END showing years
        \chronos@from@clist{dyddiadau_coords}{\chronos@coords}%
        \ifx\chronos@coords\@empty\relax % BEGIN 
        \else
          \foreach \i in \chronos@coords {%
            \chronos@set@date{\i}{01}{01}{tempa}% awto-cywiro am flwyddyn sero
            \pgfmathsetmacro\chronos@temph{(\thechronos@tempadate-\thechronos@startdate)*\chronos@unit}%
            \edef\chronos@tempa{\chronos@tempayear}\edef\chronos@tempb{\i}%
            \ifx\chronos@tempa\chronos@tempb
              \coordinate (chronos year \i) at (\chronos@temph pt,0pt);
            \else
              \coordinate (chronos date \i) at (\chronos@temph pt,0pt);
            \fi
          }%
        \fi% END
        \ifchronos@eventyearsonline
          \pgfqkeys{/chronos}{%
            timeline years=on line,
          }%
        \fi
      \end{scope}% [/chronos/chronos@llinell amser@haenen] ?
      % phantom nodes - haws i gosodi pethau
      \begin{scope}[byw,every node/.append style={/chronos/@testun=chronos@prifliw,/chronos/placeholder}]%
        \ifnum\chronos@uchod>0
          \node (u1) [anchor=south west, yshift=\chronos@borderheight+2pt, alias=level 1] at (chronos top -| \chronos@lefelau@at) {\phantom{Enw}u1 \textbar{} level 1\\\phantom{1234}};
          \ifnum\chronos@uchod>1
            \foreach \i [count=\ino] in {2,...,\chronos@uchod} \node (u\i) [anchor=south west, alias=level \i] at (u\ino.north west) {\phantom{Enw}u\i{} \textbar{} level \i\\\phantom{1234}};
          \fi
        \fi
        \ifnum\chronos@isod>0
          \node (i1) [anchor=north west, yshift=-\chronos@borderheight-2pt, alias=level -1] at (chronos base -| \chronos@lefelau@at) {\phantom{Enw}i1 \textbar{} level -1\\\phantom{1234}};
          \ifnum\chronos@isod>1
            \foreach \i [count=\ino] in {2,...,\chronos@isod} \node (i\i) [anchor=north west, alias=level -\i] at (i\ino.south west) {\phantom{Enw}i\i{} \textbar{} level -\i\\\phantom{1234}};
          \fi
        \fi
        \ifchronos@showcoords
          \begin{scope}[on chronos overlay layer]
            \ifnum\chronos@uchod>0
              \foreach \i in {1,...,\chronos@uchod} \draw [help lines, draw=chronos@lliw@node] (u\i.north east) -| (u\i.south west) -| cycle;
            \fi
            \ifnum\chronos@isod>0
              \foreach \i in {1,...,\chronos@isod} \draw [help lines, draw=chronos@lliw@node] (i\i.north east) -| (i\i.south west) -| cycle;            
            \fi
          \end{scope}%[on chronos overlay layer]
        \fi
      \end{scope}% [byw,every node/.append style={/chronos/@testun=chronos@prifliw,/chronos/placeholder}]% ?
      \let\ceyearlabel\chronos@yearce
      \let\bceyearlabel\chronos@yearbce
      \let\celabel\chronos@ce
      \let\bcelabel\chronos@bce
      \let\timelineborderht\chronos@borderheight
      \let\timelinewd\chronos@width
      \let\lineyshift\chronos@llinell@yshift
}{% oedd yn execute at end picture={...}
      \ifchronos@frame
        \ifchronos@headings\relax
        \else
          \ifchronos@framedefnyddiobb\relax
          \else
            \pgfqkeys{/chronos}{subheadings drops'=0pt:0pt}%
            \chronos@headingstrue
          \fi % \ifchronos@framedefnyddiobb
        \fi % \ifchronos@headings
      \fi % \ifchronos@frame
      \ifchronos@headings
        \ifdim\chronos@heading@drop=0pt
          \chronos@heading@drop=15pt
          \PackageWarning{chronos}{Setting headings drop to 15pt}%
        \fi
        \ifdim\chronos@subheading@drop@uchod=0pt
          \chronos@subheading@drop@uchod=12pt
          \PackageWarning{chronos}{Setting upper subheading drop to 12pt}%
        \fi
        \ifdim\chronos@subheading@drop@isod=0pt
          \chronos@subheading@drop@isod=10pt
          \PackageWarning{chronos}{Setting lower subheading drop to 10pt}%
        \fi
        \ifnum\chronos@uchod=0
          \coordinate (u0) at (current bounding box.north);
          \PackageWarning{chronos}{Placing (u0) at (current bounding box.north) for headings placement.}%
        \fi
        \ifdim\chronos@border@penawdau=\pi pt
          \IfIntCompareTF {\chronos@uchod > 0}
          {%    
            \chronos@border@penawdau=15pt
            \PackageWarning{chronos}{Allowing 15pt plus headings and subheadings drops for headings.}%
          }{%
            \chronos@border@penawdau=5pt
            \PackageWarning{chronos}{Allowing 5pt plus headings and subheadings drops for headings.}%
          }%
          \advance \chronos@border@penawdau by \chronos@heading@drop
          \advance \chronos@border@penawdau by \chronos@subheading@drop@uchod
          \advance \chronos@border@penawdau by \chronos@subheading@drop@isod
        \fi
        \ifnum\chronos@isod=0
          \coordinate (i0) at (current bounding box.south);
          \PackageWarning{chronos}{Placing (i0) at (current bounding box.south) for structural purposes.}%
        \fi
        \chronos@templgtha=\chronos@border@penawdau
        \advance\chronos@templgtha by \chronos@border@pen
        \coordinate (chronos margin top) at ($(u\chronos@uchod.north -| chronos post) + (0pt,\chronos@templgtha)$);
        \chronos@templgtha=\chronos@border@pen
        \advance\chronos@templgtha by \chronos@heading@drop
        \coordinate (chronos main headings) at ($(chronos margin top) - (0pt,\chronos@templgtha)$);% oedd pen & gwahanol
        \coordinate (chronos bottom) at ($(i\chronos@isod.south) + (0pt,-\chronos@border@gwaelod)$);% oedd gwaelod
        \coordinate (chronos upper subheadings) at ($(chronos main headings) - (0pt,\chronos@subheading@drop@uchod)$);% oedd pwy1
        \coordinate (chronos lower subheadings) at ($(chronos upper subheadings) - (0pt,\chronos@subheading@drop@isod)$);% oedd pwy2
        \coordinate (chronos@de) at ($(chronos post) + (\chronos@border@de,0pt)$);% oedd de
        \coordinate (chronos@chwith) at ($(chronos pre) + (-\chronos@border@chwith,0pt)$);% oedd chwith
  %       \coordinate (chronos@chwith1) at ($(chronos pre) + (\chronos@border@chwith,0pt)$);% oedd chwith1
      \fi % \ifchronos@headings
      \pgfqkeys{/chronos}{@before@headings}%
      \chronos@at@end
      \pgfqkeys{/chronos}{@before@frame}%
      \ifchronos@frame
        \scoped[on chronos background layer]{%
          \ifchronos@framedefnyddiobb % if frame uses bb
            \node (chronos frame) [fit=(current bounding box), /chronos/prif/@frame] {};
          \else
            \node (chronos frame) [fit=(chronos margin top -| chronos@de) (chronos bottom -| chronos@chwith), /chronos/prif/@frame] {};
          \fi % \ifchronos@framedefnyddiobb
          \path (chronos frame.south west) ++(-\chronos@border@allanol,-\chronos@border@allanol) |- (chronos frame.north east) -- ++(\chronos@border@allanol,\chronos@border@allanol);
        }%
      \fi % \ifchronos@frame
      \pgfqkeys{/chronos}{@tikz}%
    \end{scope}% [/chronos/@style]
    \pgf@relevantforpicturesizefalse
    \pgfqkeys{/chronos}{@@tikz}%
    \ifchronos@showcoords
      \begin{scope}[on chronos overlay layer]
        \foreach \i/\j in {%
          chronos foot/-55, chronos head/north, chronos base/-25, chronos top/120, 
          chronos start/85, chronos end/85, 
          chronos pre/west, chronos post/east, 
          chronos pre-top/175, chronos post-top/15, chronos pre-base/south west, chronos post-base/south east, 
          chronos pre-head/155, chronos post-head/north east, chronos pre-foot/south, chronos post-foot/south,
          chronos origin/-85,
          chronos mid/90,
          chronos mid-time/-90%
        }
        \node [/chronos/show coord={\j}{\i}] at (\i) {}; 
        \ifchronos@timeline@showyears
          \node [/chronos/show coord={45}{chronos first marked year}] at (chronos first marked year) {};
        \fi
        \ifchronos@headings
          \foreach \i/\j in {chronos main headings/east, chronos bottom/north, chronos upper subheadings/east, chronos lower subheadings/east, chronos margin top/north}
          \node [/chronos/show coord={\j}{\i}] at (\i) {};
        \fi
        \node (chronos@gwybodaeth@coords) [below=2.5pt of current bounding box.south west, anchor=north west, every pin, text=chronos@lliw@coord] {\textbullet{} coordinates};
      \end{scope}%
    \fi % \ifchronos@showcoords
    \ifchronos@shownodes
      \begin{scope}[on chronos overlay layer]
        \ifchronos@markeras
          \foreach \i/\j in {chronos bce/south, chronos ce/-95} 
          {%
            \draw [help lines, draw=chronos@lliw@node] (\i.north west) -| (\i.south east) -| cycle;
            \node [/chronos/show node coord={\j}{\i}] at (\i) {};
          }%
        \fi % \ifchronos@markeras
        \ifchronos@frame
            \draw [help lines, draw=chronos@lliw@node] (chronos frame.north west) -| (chronos frame.south east) -| cycle;
            \node [/chronos/show node coord={north}{chronos frame}] at (chronos frame.north) {};
        \fi % \ifchronos@frame
        \ifchronos@showcoords
          \node (chronos@gwybodaeth@nodes) [right=of chronos@gwybodaeth@coords.base east, anchor=base west, every pin, text=chronos@lliw@node] {\textbullet{} nodes};
        \else
          \node (chronos@gwybodaeth@nodes) [below=2.5pt of current bounding box.south west, anchor=north west, every pin, text=chronos@lliw@node] {\textbullet{} nodes};        
        \fi % \ifchronos@showcoords
      \end{scope}%
    \fi % \ifchronos@shownodes
    \ifchronos@showbb
      \begin{scope}[on chronos overlay layer]
        \draw [help lines,draw=chronos@lliw@bb] (current bounding box.north east) -| (current bounding box.south west) -| cycle;
        \node [/chronos/show coordinate={chronos@lliw@bb}{90}{bounding box}{15pt}{}] at (current bounding box.120) {};
        \ifchronos@shownodes
          \node (chronos@gwybodaeth@bb) [right=of chronos@gwybodaeth@nodes.base east, anchor=base west, every pin, text=chronos@lliw@bb] {\textbullet{} bounding box};
        \else
          \ifchronos@showcoords
            \node (chronos@gwybodaeth@bb) [right=of chronos@gwybodaeth@coords.base east, anchor=base west, every pin, text=chronos@lliw@bb] {\textbullet{} bounding box};
          \else
            \node (chronos@gwybodaeth@bb) [below=2.5pt of current bounding box.south west, anchor=north west, every pin, text=chronos@lliw@bb] {\textbullet{} bounding box};        
          \fi % \ifchronos@showcoords
        \fi % \ifchronos@shownodes
      \end{scope}%
    \fi % \ifchronos@showbb
  \end{tikzpicture}%
  % ailosod pethau rhagosodedig sy'n gosod gyda \g neu \global
  \chronos@global@clear@to@clist{century_subheadings}%
  \chronos@lliwiau@clear
  \ifchronos@byw@isod@rhag \global\chronos@byw@isodtrue \else \global\chronos@byw@isodfalse\fi
  \ifchronos@digwyddiad@isod@rhag \global\chronos@digwyddiad@isodtrue \else \global\chronos@digwyddiad@isodfalse\fi
  \ifchronos@parhad@isod@rhag \global\chronos@parhad@isodtrue \else \global\chronos@parhad@isodfalse\fi
  \let\chronosset\@chronosset
}
% END chronos
% END env y ddogfen
% BEGIN macros y ddogfen
% BEGIN chronosset
\NewDocumentCommand \@chronosset { s m } {%
  \pgfqkeys{/chronos}{#2}%
  \IfBooleanF{#1}{%
    \ifchronos@byw@isod\chronos@byw@isod@rhagtrue\else\chronos@byw@isod@rhagfalse\fi
    \ifchronos@digwyddiad@isod\chronos@digwyddiad@isod@rhagtrue\else\chronos@digwyddiad@isod@rhagfalse\fi
    \ifchronos@parhad@isod\chronos@parhad@isod@rhagtrue\else\chronos@parhad@isod@rhagfalse\fi
    \chronos@lliwiau@cadw@rhag}}
\NewDocumentCommand \@@chronosset { s m }
{%
  \PackageWarning{chronos}{%
    \bs chronosset has no effect inside a chronos environment.
    Usage ignored %
  }%
}
\let\chronosset\@chronosset
% END chronosset
% BEGIN \byw
\NewDocumentCommand\byw { m }{%
  \begingroup
    \Undefine\chronos@byw@labelgeni
    \Undefine\chronos@byw@labelmarw
    \Undefine\chronos@byw@angor
    \Undefine\chronos@byw@at
    \Undefine\chronos@byw@invanchor
    \Undefine\chronos@cynnwys@testun
    \Undefine\chronos@cynnwys@dyddiadau
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@cysylltwyr
    \chronos@byw@cysylltiadtheorifalse % rhag ofn
    \tikzset{byw={enw={??},marw={\year-\month-\day},bu farw=false,#1}}%
    \ifchronos@eventdatessplit\PackageInfo{chronos}{Setting split false for non-event.}\chronos@eventdatessplitfalse\fi
    \pgfmathsetmacro\chronos@temph{(\thechronos@genidate-\thechronos@startdate)*\chronos@unit}%
    \pgfmathsetmacro\chronos@tempk{(\thechronos@marwdate-\thechronos@startdate)*\chronos@unit}%
    \pgfmathsetmacro\chronos@templ{(\chronos@temph+\chronos@tempk)*\chronos@unit/2}%
    % temporary coordinate accurate only for x
    \coordinate (\chronos@byw@tikzname) at (\chronos@templ pt,0pt);
    \chronos@troilliwiau@tag{byw}%
    \chronos@gosodangor@tag{byw}%
    \chronos@gosodborder@tag{byw}%
    \IfExistTF \chronos@cynnwys@testun{%
      \let\chronos@cynnwys@dyddiadau\relax
      \let\chronos@cynnwys@enw\relax
    }{%
      \IfExistF \chronos@cynnwys@enw {%
        \def \chronos@cynnwys@enw {\chronos@enw@priflythrennu{\chronos@byw@enw}}%
      }%
      \IfExistTF \chronos@cynnwys@dyddiadau {%
        \pretocmd \chronos@cynnwys@dyddiadau {\\\chronos@byw@ffontdyddiad}{}{}%
      }{%
        \ifchronos@onlytext\let\chronos@cynnwys@dyddiadau\relax
        \else
          \ifchronos@bufarw\relax\else\def\chronos@byw@labelmarw{}\fi
          \chronos@dyddiadau@tag{byw}{geni}{geni}{marw}{marw}%
          \ifchronos@temp
            \def \chronos@cynnwys@dyddiadau {\\\chronos@byw@ffontdyddiad\chronos@byw@labelmarw}%
          \else
            \def \chronos@cynnwys@dyddiadau {\\\chronos@byw@ffontdyddiad\chronos@byw@labelgeni--\chronos@byw@labelmarw}%
          \fi
        \fi
      }%
      \def \chronos@cynnwys@testun {{\chronos@byw@ffonttestun\chronos@cynnwys@enw}\chronos@cynnwys@dyddiadau}%
    }%
    \chronos@creu@llinell {byw}{\chronos@temph pt}{\chronos@tempk pt}{geni}{marw}%
    % final coordinate accurate for x and y
    \coordinate (\chronos@byw@tikzname) at ($(\chronos@byw@tikzname{} geni)!1/2!(\chronos@byw@tikzname{} marw)$);
    % creu cylcu ar y lein ; testun - prif node ; testun cylch ; prif gysylltiad
    \chronos@creu@testun@tag{byw}{\chronos@cynnwys@testun}%
    \ifchronos@byw@cysylltiadtheori
%       \scoped[/chronos/middle anchorborder]{% ateb Symbol 1: https://tex.stackexchange.com/a/385953/
        \chronos@angorau@theori{testun \chronos@byw@tikzname}{cysylltwr \chronos@byw@tikzname}[connector \chronos@byw@tikzname]{/chronos/@cysylltwr@testun=\chronos@byw@lliw}%
%       }%
    \fi
    \ifchronos@every@byw@isod
      \global\chronos@byw@isodtrue
    \else\ifchronos@every@byw@uchod
        \global\chronos@byw@isodfalse
      \else
        \ifchronos@byw@isod\global\chronos@byw@isodfalse\else\global\chronos@byw@isodtrue\fi
      \fi
    \fi
    \chronos@ailosod@nodweddion
  \endgroup
}
% END \byw
% BEGIN \digwyddiad
\NewDocumentCommand\digwyddiad { m }{%
  \begingroup
    \Undefine\chronos@digwyddiad@angor
    \Undefine\chronos@digwyddiad@invanchor
    \Undefine\chronos@digwyddiad@at
    \Undefine\chronos@cynnwys@testun
    \Undefine\chronos@cynnwys@dyddiadau
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@cysylltwyr
    \chronos@digwyddiad@cysylltiadtheorifalse % rhag ofn
    % oedd problem yn pasio every@digwyddiad i digwyddiad pan iddo fe'n cynnwys font=\unrhywbeth
    \tikzset{digwyddiad={enw={??},#1}}%
    \pgfmathsetmacro\chronos@temph{(\thechronos@digdate-\thechronos@startdate)*\chronos@unit}%
    % temporary coordinate accurate only for x
    \coordinate (\chronos@digwyddiad@tikzname) at (\chronos@temph pt,0pt);
    \chronos@troilliwiau@tag{digwyddiad}%
    \chronos@gosodangor@tag{digwyddiad}%
    \chronos@gosodborder@tag{digwyddiad}%
    \ifchronos@eventdatessplit
      \ifchronos@onlytext\relax
        \IfExistF \chronos@cynnwys@testun {%
          \IfExistTF  \chronos@cynnwys@enw {%
            \def\chronos@cynnwys@testun {\chronos@digwyddiad@ffonttestun\chronos@cynnwys@enw}
          }{%
            \def \chronos@cynnwys@testun {\chronos@digwyddiad@ffonttestun\chronos@enw@priflythrennu{\chronos@digwyddiad@enw}}%
          }%
        }%
      \else
        \IfExistF \chronos@cynnwys@testun {%
          \IfExistF \chronos@cynnwys@dyddiadau {%
            \def \chronos@cynnwys@dyddiadau {\chronos@showdate@cs[chronos@digwyddiad@fformatdyddiad]{dig}}%
          }%
          \IfExistTF  \chronos@cynnwys@enw {%
            \def\chronos@cynnwys@testun {\chronos@digwyddiad@ffonttestun\chronos@cynnwys@enw}
          }{%
            \def \chronos@cynnwys@testun {\chronos@digwyddiad@ffonttestun\chronos@enw@priflythrennu{\chronos@digwyddiad@enw}}%
          }%
        }%
      \fi
    \else % not event date split
      \IfExistTF \chronos@cynnwys@testun {%
        \let\chronos@cynnwys@dyddiadau\relax
        \let\chronos@cynnwys@enw\relax
      }{%
        \IfExistF {\chronos@cynnwys@enw}{%
          \def \chronos@cynnwys@enw {\chronos@enw@priflythrennu{\chronos@digwyddiad@enw}}%
        }%
        \IfExistTF \chronos@cynnwys@dyddiadau {%
          \apptocmd \chronos@cynnwys@dyddiadau {\\}{}{}%
          \pretocmd \chronos@cynnwys@dyddiadau {\chronos@digwyddiad@ffontdyddiad}{}{}%
        }{%
          \ifchronos@onlytext\let\chronos@cynnwys@dyddiadau\relax
          \else
            \def \chronos@cynnwys@dyddiadau {\chronos@digwyddiad@ffontdyddiad\chronos@showdate@cs[chronos@digwyddiad@fformatdyddiad]{dig}\\}%
          \fi
        }%
        \def \chronos@cynnwys@testun {\chronos@cynnwys@dyddiadau\chronos@digwyddiad@ffonttestun\chronos@cynnwys@enw}%
      }%
    \fi
    % marcio digwyddiad ar y lein
    \begin{scope}[/chronos/chronos@llinell@haenen]% finalise coordinate placement
      \path [/chronos/@llinell=\chronos@digwyddiad@lliw] ({\chronos@temph pt,0} |- \chronos@border@coord) -- +(0pt,\chronos@digwyddiad@border) coordinate (\chronos@digwyddiad@tikzname);
      \ifchronos@eventdatessplit
        \path [/chronos/@llinell=\chronos@digwyddiad@lliw] ({\chronos@temph pt,0} |- \chronos@border@coord@inv) -- +(0pt,\chronos@digwyddiad@border@inv) coordinate (\chronos@digwyddiad@tikzname-inv);      
      \fi
    \end{scope}%
    % creu cylcu ar y lein ; testun - prif node ; testun cylch ; prif gysylltiad
    \ifchronos@eventdatessplit
      \chronos@creu@testun@tag*{digwyddiad}{\chronos@cynnwys@dyddiadau}% angen defnyddio  /chronos/event date split
    \fi
    \chronos@creu@testun@tag{digwyddiad}{\chronos@cynnwys@testun}%
    % dyddiad arbennig
    \ifchronos@eventyearsonline
      \edef\chronos@tempa{none}%
      \edef\chronos@tempb{\chronos@specialdate}%
      \ifx\chronos@tempa\chronos@tempb
        \def\chronos@tempbd{\chronos@showdate@cs[chronos@digwyddiad@fformatdyddiad]{dig}}%
      \else
        \let\chronos@tempbd\chronos@specialdate\gdef\chronos@specialdate{none}%
      \fi
      \scoped[/chronos/chronos@llinell amser@haenen]{\node [/chronos/event year on line] at (\chronos@temph pt,0pt) {\chronos@tempbd};}%
    \fi
    \ifchronos@digwyddiad@cysylltiadtheori
%       \scoped[/chronos/middle anchorborder]{% ateb Symbol 1: https://tex.stackexchange.com/a/385953/
        \chronos@angorau@theori{testun \chronos@digwyddiad@tikzname}{cysylltwr \chronos@digwyddiad@tikzname}[connector \chronos@digwyddiad@tikzname]{/chronos/@cysylltwr@testun=\chronos@digwyddiad@lliw}%
%       }%
    \fi
    \ifchronos@every@digwyddiad@isod
      \global\chronos@digwyddiad@isodtrue
    \else\ifchronos@every@digwyddiad@uchod
        \global\chronos@digwyddiad@isodfalse
      \else
        \ifchronos@digwyddiad@isod\global\chronos@digwyddiad@isodfalse\else\global\chronos@digwyddiad@isodtrue\fi
      \fi
    \fi
    \chronos@ailosod@nodweddion
  \endgroup
}
% END \digwyddiad
% BEGIN \parhad
\NewDocumentCommand\parhad { m }{%
  \begingroup
    \Undefine\chronos@parhad@labeldechrau
    \Undefine\chronos@parhad@labeldiwedd
    \Undefine\chronos@parhad@angor
    \Undefine\chronos@parhad@at
    \Undefine\chronos@parhad@invanchor
    \Undefine\chronos@cynnwys@testun
    \Undefine\chronos@cynnwys@dyddiadau
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@cysylltwyr
    \chronos@parhad@cysylltiadtheorifalse % rhag ofn
    \tikzset{parhad={enw={??},diwedd={\year-\month-\day},gorffenedig=false,#1}}%
    \ifchronos@eventdatessplit\PackageInfo{chronos}{Setting split false for non-event.}\chronos@eventdatessplitfalse\fi
    \pgfmathsetmacro\chronos@temph{(\thechronos@thingdate-\thechronos@startdate)*\chronos@unit}%
    \pgfmathsetmacro\chronos@tempk{(\thechronos@otherthingdate-\thechronos@startdate)*\chronos@unit}%
    \pgfmathsetmacro\chronos@templ{(\chronos@temph+\chronos@tempk)*\chronos@unit/2}%
    % temporary coordinate accurate only for x
    \coordinate (\chronos@parhad@tikzname) at (\chronos@templ pt,0pt);
    \chronos@troilliwiau@tag{parhad}%
    \chronos@gosodangor@tag{parhad}%
    \chronos@gosodborder@tag{parhad}%
    \IfExistTF \chronos@cynnwys@testun{%
      \let\chronos@cynnwys@dyddiadau\relax
      \let\chronos@cynnwys@enw\relax
    }{%
      \IfExistF \chronos@cynnwys@enw {%
        \def \chronos@cynnwys@enw {\chronos@enw@priflythrennu{\chronos@parhad@enw}}%
      }%
      \IfExistTF \chronos@cynnwys@dyddiadau {%
        \apptocmd \chronos@cynnwys@dyddiadau {\\}{}{}%
      }{%
        \ifchronos@onlytext\let\chronos@cynnwys@dyddiadau\relax
        \else
          \ifchronos@gorffenedig\relax\else\def\chronos@parhad@labeldiwedd{}\fi
          \chronos@dyddiadau@tag{parhad}{thing}{dechrau}{otherthing}{diwedd}%
          \ifchronos@temp
            \def \chronos@cynnwys@dyddiadau {\chronos@parhad@labeldechrau\\}%
          \else
            \def \chronos@cynnwys@dyddiadau {\chronos@parhad@labeldechrau--\chronos@parhad@labeldiwedd\\}%
          \fi
        \fi
      }%
      \def \chronos@cynnwys@testun {\chronos@parhad@ffontdyddiad\chronos@cynnwys@dyddiadau\chronos@parhad@ffonttestun\chronos@cynnwys@enw}%
    }%
    \chronos@creu@llinell {parhad}{\chronos@temph pt}{\chronos@tempk pt}{dechrau}{diwedd}%
    % final coordinate placement
    \coordinate (\chronos@parhad@tikzname) at ($(\chronos@parhad@tikzname{} dechrau)!1/2!(\chronos@parhad@tikzname{} diwedd)$);
    % creu cylcu ar y lein ; testun ; testun cylch ; prif gysylltiad
    \chronos@creu@testun@tag{parhad}{\chronos@cynnwys@testun}%
    \ifchronos@parhad@cysylltiadtheori
%       \scoped[/chronos/middle anchorborder]{% ateb Symbol 1: https://tex.stackexchange.com/a/385953/
        \chronos@angorau@theori{testun \chronos@parhad@tikzname}{cysylltwr \chronos@parhad@tikzname}[connector \chronos@parhad@tikzname]{/chronos/@cysylltwr@testun=\chronos@parhad@lliw}%
%       }%
    \fi
    \ifchronos@every@parhad@isod
      \global\chronos@parhad@isodtrue
    \else\ifchronos@every@parhad@uchod
        \global\chronos@parhad@isodfalse
      \else
        \ifchronos@parhad@isod\global\chronos@parhad@isodfalse\else\global\chronos@parhad@isodtrue\fi
      \fi
    \fi
    \chronos@ailosod@nodweddion
  \endgroup
}
% END \parhad
% BEGIN \theori XXX
\NewDocumentCommand\theori { m }{%
  \begingroup
    \Undefine\chronos@theori@angor
    \Undefine\chronos@theori@at
    \Undefine\chronos@theori@invanchor
    \Undefine\chronos@cynnwys@testun
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@cynnwys@dyddiadau
    \Undefine\chronos@cysylltwyr
    \chronos@theori@cysylltiadtheorifalse % rhag ofn
    \tikzset{theori={enw={??},#1}}%
    \chronos@troilliwiau@tag{theori}%
    \IfExistTF \chronos@theori@angor{%
      \IfExistTF \chronos@cysylltwyr{%
        \pretocmd\chronos@cysylltwyr{\chronos@theori@angor,}{}{}%
      }{%
        \def\chronos@cysylltwyr{\chronos@theori@angor}%
      }%
    }{%
      \ifchronos@theori@isod\def\chronos@theori@angor{north}\else\def\chronos@theori@angor{south}\fi
    }%
    \IfExistTF \chronos@cynnwys@testun {%
      \let\chronos@cynnwys@enw\relax
    }{%
      \IfExistF \chronos@cynnwys@enw {%
        \def \chronos@cynnwys@enw {\chronos@enw@priflythrennu{\chronos@theori@enw}}%
      }%
      \def \chronos@cynnwys@testun {\chronos@cynnwys@enw}%
    }%
    % creu testun (text tag)
    \chronos@creu@testun@tag[alias=\chronos@theori@tikzname]{theori}{\chronos@theori@ffonttestun\chronos@cynnwys@testun}%
%     \begin{scope}[/chronos/middle anchorborder]% ateb Symbol 1: https://tex.stackexchange.com/a/385953/
      \IfExistT \chronos@cysylltwyr{%
        \chronos@angorau@theori{\chronos@theori@enw}{cysylltwr \chronos@theori@enw}[connector \chronos@theori@enw]{/chronos/@cysylltwr@testun=\chronos@theori@lliw}}%
%     \end{scope}%
    \chronos@ailosod@nodweddion
  \endgroup
}
% END \theori
% BEGIN \chronos@angorau@theori
\NewDocumentCommand \chronos@angorau@theori{mmO{connector }m}{% #1 enw y prif node ; #2 enw yr angor cyntaf ; #4 style
  \ifchronos@phantom
    \PackageWarning{chronos}{Phantom tags cannot have connectors }%
  \else
    \begin{scope}[/chronos/middle anchorborder]% ateb Symbol 1: https://tex.stackexchange.com/a/385953/
      \setcounter{chronos@theori@countanchors}{0}%
      \@for \xx:=\chronos@cysylltwyr \do {%
        \stepcounter{chronos@theori@countanchors}%
        \ifnum\value{chronos@theori@countanchors}=1%
          \node (#2) [#4, alias=#2\thechronos@theori@countanchors, alias=#3, alias=#3\thechronos@theori@countanchors] at (#1.middle \xx) {};
        \else
          \node (#2\thechronos@theori@countanchors) [#4, alias=#3\thechronos@theori@countanchors] at (#1.middle \xx) {};
        \fi
      }%
    \end{scope}%
  \fi
}
% END \chronos@angorau@theori
% BEGIN \cylchtheori - cylchau bychain yn lle bocses mawr
\NewDocumentCommand \cylchtheori { m } {%
  \begingroup
    \Undefine\chronos@cylchtheori@at
    \Undefine\chronos@cynnwys@testun
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@cynnwys@dyddiadau
    \tikzset{cylch theori={enw={??},#1}}%
    % ni all wneud y cam hwn a'r un nesaf gyda'i gilydd - wn i ddim yn siwr pam lai
    \coordinate [/chronos/every@cylch cylch theori, /utils/exec=\pgfkeysalsofrom{\chronos@cadw}] (\chronos@cylchtheori@tikzname1) at  (chronos@cylchtheori@at);
    \path [/chronos/every@cylch cylch theori] (\chronos@cylchtheori@tikzname1) circle (\chronos@cylchtheori@bach) circle (\chronos@cylchtheori@mawr);
    \pgfmathsetlength\chronos@templgtha{\chronos@cylchtheori@bach+0.5pt}%
    \pgfmathsetlength\chronos@templgthc{\chronos@cylchtheori@mawr-0.5pt}%
    \pgfmathsetlength\chronos@templgthb{\chronos@cylchtheori@mawr+2pt}%
    \coordinate (\chronos@cylchtheori@tikzname2) at ($(\chronos@cylchtheori@tikzname1) - (\chronos@templgtha,0)$);
    \coordinate (\chronos@cylchtheori@tikzname3) at ($(\chronos@cylchtheori@tikzname1) - (\chronos@templgthc,0)$);
    \coordinate (\chronos@cylchtheori@tikzname4) at ($(\chronos@cylchtheori@tikzname1) + (0,\chronos@templgthb)$);
    \coordinate (\chronos@cylchtheori@tikzname5) at ($(\chronos@cylchtheori@tikzname1) - (0,\chronos@templgthb)$);
    \path [/chronos/every@testun cylch theori/.expanded={\ \chronos@cylchtheori@circletext@uchod\ }] (\chronos@cylchtheori@tikzname2) arc (180:0:\chronos@templgtha);
    \path [/chronos/every@testun cylch theori/.expanded={\chronos@cylchtheori@circletext@isod}] (\chronos@cylchtheori@tikzname3) arc (180:360:\chronos@templgthc);
    \node (label above \chronos@cylchtheori@tikzname) [anchor=south, /chronos/theori/cylchau/@label] at (\chronos@cylchtheori@tikzname4) {\chronos@cylchtheori@label@uchod};
    \node (label below \chronos@cylchtheori@tikzname) [anchor=north, /chronos/theori/cylchau/@label] at (\chronos@cylchtheori@tikzname5) {\chronos@cylchtheori@label@isod};
    \node (\chronos@cylchtheori@tikzname) [fit=(label below \chronos@cylchtheori@tikzname) (label above \chronos@cylchtheori@tikzname) (\chronos@cylchtheori@tikzname4) (\chronos@cylchtheori@tikzname5)] {};
    \chronos@ailosod@nodweddion
  \endgroup
}
% END \cylchtheori
% BEGIN \prifdeitl
\NewDocumentCommand \prifdeitl {  m }
{% 
  \begingroup
    \Undefine\chronos@prifdeitl@at
    \Undefine\chronos@prifdeitl@angor
    \tikzset{prif={#1}}%
    \IfExistF\chronos@prifdeitl@angor{\def\chronos@prifdeitl@angor{center}}%
    \IfExistTF\chronos@prifdeitl@tikzname{%
      \pgfqkeys{/chronos}{@tempd/.style={alias=prif deitl,alias=main title}}%
    }{%
      \def\chronos@prifdeitl@tikzname{prif deitl}%
      \pgfqkeys{/chronos}{@tempd/.style={alias=main title}}%
    }%
    \IfFreeT {\chronos@prifdeitl@cynnwys}{\def\chronos@prifdeitl@cynnwys{\chronos@enw@priflythrennu{\chronos@prifdeitl@enw}}}%
    \draw node (\chronos@prifdeitl@tikzname) [draw=none,/chronos/@tempd, /chronos/prif/@teitl, anchor=\chronos@prifdeitl@angor, /utils/exec=\pgfkeysalsofrom{\chronos@cadw}] at (chronos@prifdeitl@at) {\chronos@prifdeitl@cynnwys};
    \ifchronos@showcoords
      \begin{scope}[on chronos overlay layer]
        \draw [help lines, draw=chronos@lliw@node] (\chronos@prifdeitl@tikzname.north east) -| (\chronos@prifdeitl@tikzname.south west) -| cycle;
        \node [/chronos/show coordinate={chronos show node colour}{0}{\chronos@prifdeitl@tikzname}{10pt}{align=center}] at (\chronos@prifdeitl@tikzname.east) {};
      \end{scope}%
    \fi
  \endgroup
}
% END \prifdeitl
% BEGIN \gwybodaeth
\NewDocumentCommand \gwybodaeth { s m }{%
  \begingroup
    \Undefine\chronos@gwybodaeth@angor
    \Undefine\chronos@gwybodaeth@at
    \let\chronos@cynnwys@testun\@empty
    \Undefine\chronos@cynnwys@enw
    \Undefine\chronos@gwybodaeth@capsiwn
    \tikzset{gwybodaeth={enw={??},#2}}%
    \IfExistF \chronos@gwybodaeth@angor{\def\chronos@gwybodaeth@angor{west}}%%
    \IfExistF \chronos@gwybodaeth@capsiwn {%
      \def \chronos@gwybodaeth@capsiwn {\chronos@enw@priflythrennu{\chronos@gwybodaeth@enw}}%
    }%
    \IfExistF \chronos@gwybodaeth@lliw {\let\chronos@gwybodaeth@lliw\chronos@gwybodaeth@lliw@rhagosodedig}%
    \node (testun \chronos@gwybodaeth@tikzname) [/chronos/@testun=\chronos@gwybodaeth@lliw, anchor=\chronos@gwybodaeth@angor, /chronos/.cd, /utils/exec=\pgfkeysalsofrom{\chronos@cadw}, alias=tag \chronos@gwybodaeth@tikzname, alias=text tag \chronos@gwybodaeth@tikzname, alias=\chronos@gwybodaeth@tikzname] at (\chronos@gwybodaeth@at) {\chronos@cynnwys@testun};
    \IfBooleanF {#1}{%
      \node (capsiwn \chronos@gwybodaeth@tikzname) [/chronos/gwybodaeth/@label, alias=enw \chronos@gwybodaeth@tikzname, alias=name \chronos@gwybodaeth@tikzname, alias=label \chronos@gwybodaeth@tikzname, alias=caption \chronos@gwybodaeth@tikzname] at (\chronos@gwybodaeth@tikzname.south) {\chronos@gwybodaeth@capsiwn};
    }%
    \edef\chronos@tempa{lliw \chronos@gwybodaeth@tikzname}%
    \edef\chronos@tempe{colour \chronos@gwybodaeth@tikzname}%
    \edef\chronos@tempf{color \chronos@gwybodaeth@tikzname}%
    \edef\chronos@tempb{\chronos@gwybodaeth@lliw}%
    \xglobal\colorlet{\chronos@tempa}{\chronos@tempb}%
    \xglobal\colorlet{\chronos@tempe}{\chronos@tempb}%
    \xglobal\colorlet{\chronos@tempf}{\chronos@tempb}%
    \colorlet{chronos current tag colour}{\chronos@tempb}%
    \colorlet{chronos current tag color}{\chronos@tempb}%
    \chronos@ailosod@nodweddion
  \endgroup
}
% END \gwybodaeth
% BEGIN \hawlfraint
\NewDocumentCommand \hawlfraint { m }
{%
  \begingroup
    \Undefine\chronos@hawlfraint@at
    \Undefine\chronos@hawlfraint@enw
    \def\chronos@hawlfraint@angor{north west}%
    \def\chronos@hawlfraint@cylchdroi{90}%
    \tikzset{hawlfraint={#1}}%
    \IfExistF{\chronos@hawlfraint@notis}{%
      \ifchronos@copyleft
        \def\chronos@hawlfraint@notis##1##2{Copyleft \textcopyleft{} ##1 ##2}%
      \else
        \def\chronos@hawlfraint@notis##1##2{Copyright \textcopyright{} ##1 ##2}%
      \fi
    }%
    \IfExistF{\chronos@hawlfraint@at}{%
      \def\chronos@hawlfraint@at{current bounding box.south west}%
      \PackageWarning{chronos}{Placing copyright notice at bottom left }%
    }%
    \IfExistF {\chronos@hawlfraint@cynnwys}{%
      \IfBooleanExprTF { \CSFreeBoolean \chronos@hawlfraint@enw || ! (\CSFreeBoolean \chronos@hawlfraint@awdur) || ! (\CSFreeBoolean \chronos@hawlfraint@blwyddyn) }{%
        \IfExistF {\chronos@hawlfraint@awdur}{%
          \IfExistTF {\svnauthor} {%
            \IfExistTF {\svnFullAuthor} {%
              \def\chronos@hawlfraint@awdur{\svnFullAuthor{\svnauthor}}%
            }{%
              \let\chronos@hawlfraint@awdur\svnauthor
            }%
          }{%
            \def\chronos@hawlfraint@awdur{Author}%
          }%
        }%
        \IfExistF {\chronos@hawlfraint@blwyddyn}{%
          \IfExistTF {\svnyear} {%
            \let\chronos@hawlfraint@blwyddyn\svnyear
          }{%
            \let\chronos@hawlfraint@blwyddyn\today
          }%
        }%
        \def\chronos@hawlfraint@cynnwys{\chronos@hawlfraint@notis{\chronos@hawlfraint@blwyddyn}{\chronos@hawlfraint@awdur}}%
      }{%
        \def\chronos@hawlfraint@cynnwys{\chronos@hawlfraint@notis{\chronos@hawlfraint@blwyddyn}{\chronos@enw@priflythrennu{\chronos@hawlfraint@enw}}}%
      }%
    }%
    \IfExistTF{\chronos@hawlfraint@tikzname}{%
      \pgfqkeys{/chronos}{@tempd/.style={alias=hawlfraint,alias=copyright,alias=copyleft}}%
    }{%
      \def\chronos@hawlfraint@tikzname{hawlfraint}%
      \pgfqkeys{/chronos}{@tempd/.style={alias=copyright,alias=copyleft}}%
    }%
%     \draw node (\chronos@hawlfraint@tikzname) [draw=none,/chronos/@tempd, /chronos/@hawlfraint, anchor=\chronos@hawlfraint@angor,rotate/.expand once=\chronos@hawlfraint@cylchdroi,/utils/exec=\pgfkeysalsofrom{\chronos@cadw}] at (chronos@hawlfraint@at) {\chronos@hawlfraint@cynnwys};
    \draw node (\chronos@hawlfraint@tikzname) [draw=none,/chronos/@tempd, /chronos/@hawlfraint, anchor=\chronos@hawlfraint@angor,rotate=\chronos@hawlfraint@cylchdroi,/utils/exec=\pgfkeysalsofrom{\chronos@cadw}] at (chronos@hawlfraint@at) {\chronos@hawlfraint@cynnwys};
    \ifchronos@showcoords
      \begin{scope}[on chronos overlay layer]
        \draw [help lines, draw=chronos@lliw@node] (\chronos@hawlfraint@tikzname.north east) -| (\chronos@hawlfraint@tikzname.south west) -| cycle;
        \node [/chronos/show coordinate={chronos show node colour}{0}{\chronos@hawlfraint@tikzname}{10pt}{align=center}] at (\chronos@hawlfraint@tikzname.east) {};
      \end{scope}%
    \fi
  \endgroup
}
\NewDocumentCommand \chronoscopyleft { m }{%
  \begingroup
    \chronos@copylefttrue
    \hawlfraint {#1}%
  \endgroup
}
% END \hawlfraint
% BEGIN \chronos@dyddiadau@tag
\NewDocumentCommand \chronos@dyddiadau@tag{mmmmm}{% #1 : tag e.g. byw / parhad ; #2 first date counter e.g. geni / thing ; #3 first label e.g. geni / dechrau ; #4 second date counter e.g. marw / otherthing ; #5 second label e.g. marw / diwedd
  \IfCSExistTF{chronos@#1@label#3}{%
    \IfCSExistF{chronos@#1@label#5}{%
      \expandafter\def\csname chronos@#1@label#5\endcsname{\chronos@showdate@cs[chronos@#1@fformat#5]{#4}}%
    }%
  }{%
    \IfCSExistF{chronos@#1@label#5}{% creu label yr ail ddyddiad
      \expandafter\def\csname chronos@#1@label#5\endcsname{\chronos@showdate@cs[chronos@#1@fformat#5]{#4}}%
    }%
    \edef\tempa{}\edef\tempb{\csname chronos@#1@label#5\endcsname}%
    \ifx\tempa\tempb
      \expandafter\def\csname chronos@#1@label#3\endcsname{\chronos@showdate@cs[chronos@#1@fformat#3@cyfnodau]{#2}}%
    \else
      \expandafter\ifnum\csname chronos@#2year\endcsname<0
        \expandafter\ifnum\csname chronos@#4year\endcsname<0
          \expandafter\def\csname chronos@#1@label#3\endcsname{\chronos@showdate@cs[chronos@#1@fformat#3@cyfnod]{#2}}%
        \else
          \expandafter\def\csname chronos@#1@label#3\endcsname{\chronos@showdate@cs[chronos@#1@fformat#3@cyfnodau]{#2}}%
        \fi
      \else
        \expandafter\def\csname chronos@#1@label#3\endcsname{\chronos@showdate@cs[chronos@#1@fformat#3@cyfnod]{#2}}%
      \fi
    \fi
  }%
  \ifchronos@dimondblynyddoedd
    \edef\chronos@tempp{\csname chronos@#2year\endcsname}%
    \edef\chronos@tempq{\csname chronos@#4year\endcsname}%
    \ifnum\chronos@tempp=\chronos@tempq\relax 
      \chronos@temptrue
    \else
      \chronos@tempfalse
    \fi
  \else
    \ifnum\value{chronos@#2date}=\value{chronos@#4date}% only catches identical blynyddoedd - dal i edrych yn dwp pan dim ond blynyddoedd yn cael eu dangos & maen' nhw'n yr un peth
      \chronos@temptrue
    \else
      \chronos@tempfalse
    \fi
  \fi
}
% END \chronos@dyddiadau@tag
% BEGIN \chronos@gosodborder@tag
\NewDocumentCommand \chronos@gosodborder@tag{m}{%
  \csname ifchronos@#1@isod\endcsname
    \ifchronos@yearsonline
      \def\chronos@border@coord{chronos base}%
      \def\chronos@border@coord@inv{chronos top}%
      \expandafter\setlength\csname chronos@#1@border\endcsname{-\chronos@borderheight}%
      \expandafter\setlength\csname chronos@#1@border@inv\endcsname{\chronos@borderheight}%
    \else
      \def\chronos@border@coord{chronos top}%
      \def\chronos@border@coord@inv{chronos base}%
      \expandafter\setlength\csname chronos@#1@border\endcsname{-\chronos@height}%
      \expandafter\setlength\csname chronos@#1@border@inv\endcsname{\chronos@height}%
    \fi
  \else
    \ifchronos@yearsonline
      \def\chronos@border@coord{chronos top}%
      \def\chronos@border@coord@inv{chronos base}%
      \expandafter\setlength\csname chronos@#1@border\endcsname{\chronos@borderheight}%
      \expandafter\setlength\csname chronos@#1@border@inv\endcsname{-\chronos@borderheight}%
    \else
      \def\chronos@border@coord{chronos base}%
      \def\chronos@border@coord@inv{chronos top}%
      \expandafter\setlength\csname chronos@#1@border\endcsname{\chronos@height}%
      \expandafter\setlength\csname chronos@#1@border@inv\endcsname{-\chronos@height}%
    \fi
  \fi
}
% END \chronos@gosodborder@tag
% BEGIN \chronos@troilliwiau@tag & configure isod/uchod
\NewDocumentCommand \chronos@troilliwiau@tag{m}{%
  \IfCSExistTF {chronos@#1@at}{%
    \edef\chronos@tempj{\csname chronos@#1@at\endcsname}%
    \path (\chronos@tempj) ++(0pt,\chronos@yshift);
    \pgfgetlastxy{\chronos@templgtha}{\chronos@templgthb}%
    \ifdim\chronos@templgthb>0pt\relax
      \expandafter\global\csname chronos@#1@isodfalse\endcsname
    \else
      \ifdim\chronos@templgthb<0pt\relax
        \expandafter\global\csname chronos@#1@isodtrue\endcsname
      \fi
    \fi
    \def\chronos@yshift@inv{-\chronos@yshift}%
  }{%
    \ifchronos@tag@cysylltu
      \CSletCS {chronos@#1@at}{chronos@#1@tikzname}% uses temporary coordinate at this point but will be aligned horizontally
    \else
      \expandafter\def\csname chronos@#1@at\endcsname{chronos origin}%
      \PackageWarning{chronos}{Aligning #1 text tag with (chronos origin). Set at to avoid this}%
    \fi
    \ifdim\chronos@yshift>0pt\relax
      \expandafter\global\csname chronos@#1@isodfalse\endcsname
      \def\chronos@yshift@inv{-\chronos@yshift}%
    \else
      \ifdim\chronos@yshift<0pt\relax
        \expandafter\global\csname chronos@#1@isodtrue\endcsname
        \def\chronos@yshift@inv{-\chronos@yshift}%
      \else
        \ifdim\chronos@testun@yshift=0pt\relax
          \PackageWarning{chronos}{Tag will be placed at the timeline's vertical centre. Set non-zero yshift or text tag yshift or set at to avoid this}%
        \fi
        \chronos@legacy@if{chronos@#1@isod}{% cheat!
          \pretocmd\chronos@cadw{yshift=-\chronos@testun@yshift,}{}{}%
          \def\chronos@yshift@inv{\chronos@testun@yshift}%
        }{%
          \pretocmd\chronos@cadw{yshift=\chronos@testun@yshift,}{}{}%
          \def\chronos@yshift@inv{-\chronos@testun@yshift}%
        }% if chronos@#1isod
      \fi % if yshift<0pt
    \fi % if yshift>0pt
  }%
  \IfCSFreeT{chronos@#1@lliw}{% \ifcsunef is T even if cs is \relax (unlike \ifcsdef which is also T if cs is \relax)
    \expandafter\ifchronos@troilliwiau
      \csname ifchronos@#1@isod\endcsname\chronos@troilliwiau@isod[#1]\else\chronos@troilliwiau@uchod[#1]\fi
    \else\CSletCS{chronos@#1@lliw}{chronos@#1@lliw@rhagosodedig}\fi
  }%
  \edef\chronos@tempa{lliw \csname chronos@#1@tikzname\endcsname}%
  \edef\chronos@tempb{\csname chronos@#1@lliw\endcsname}%
  \edef\chronos@tempe{colour \csname chronos@#1@tikzname\endcsname}%
  \edef\chronos@tempf{color \csname chronos@#1@tikzname\endcsname}%
  \xglobal\colorlet{\chronos@tempa}{\chronos@tempb}%
  \xglobal\colorlet{\chronos@tempe}{\chronos@tempb}%
  \xglobal\colorlet{\chronos@tempf}{\chronos@tempb}%
  \colorlet{chronos current tag colour}{\chronos@tempb}%
  \colorlet{chronos current tag color}{\chronos@tempb}%
  \ifchronos@enwaulliwsyml
    \edef\chronos@tempg{\csname chronos@#1@tikzname\endcsname}%
    \xglobal\colorlet{\chronos@tempg}{\chronos@tempb}%
  \fi
}
% END \chronos@troilliwiau@tag
% BEGIN \chronos@gosodangor@tag
\NewDocumentCommand\chronos@gosodangor@tag{m}{%
  \IfCSExistTF{chronos@#1@angor}{%
    \expandafter\edef\expandafter\chronos@tempa\expandafter{\csname chronos@#1@angor\endcsname}%
    \foreach \i/\j in {north/south,south/north,east/west,west/east,north west/south east,south east/north west,north east/south west,south west/north east}{%
      \edef\chronos@tempb{\i}\ifx\chronos@tempa\chronos@tempb\global\CSlet{chronos@#1@invanchor}\j\breakforeach\fi
    }%
  }{%
    \csname ifchronos@#1@isod\endcsname
      \expandafter\def\csname chronos@#1@angor\endcsname {north}%
      \expandafter\def\csname chronos@#1@invanchor\endcsname {south}%
    \else
      \expandafter\def\csname chronos@#1@angor\endcsname {south}%
      \expandafter\def\csname chronos@#1@invanchor\endcsname {north}%
    \fi
  }%
}
% END \chronos@gosodangor@tag
% BEGIN \chronos@creu@llinell (parhad, byw)
\NewDocumentCommand \chronos@creu@llinell {mmmmm}{% fill (fallai draw)} llinell ar y llinell amser am dymor estynedig
  % #1 : tag e.g. byw
  % #2 : x dimen dechrau/geni
  % #3 : x dimen diwedd/marw
  % #4 : i greu enw cyntaf e.g. dechrau/geni
  % #5 : i greu'r ail enw e.g. diwedd/marw
  \expandafter\let\expandafter\chronos@tempa\csname chronos@#1@tikzname\endcsname
  \edef\chronos@tempd{\csname chronos@#1@tikzname\endcsname-inv}%
  \expandafter\let\expandafter\chronos@tempb\csname chronos@#1@border\endcsname
  \expandafter\let\expandafter\chronos@tempc\csname chronos@#1@border@inv\endcsname
  \begin{scope}[/chronos/chronos@llinell@haenen]
    \ifchronos@yearsonline
%       \IfFreeF\bagpuss{\pgfkeys{/chronos/@llinell/.show code}}
      \path [/chronos/@llinell/.expand once=\csname chronos@#1@lliw\endcsname] ({#2,0} |- \chronos@border@coord) -- +(0pt,\chronos@tempb) coordinate (\chronos@tempa{} #4) -| ({#3,0} |- \chronos@border@coord) coordinate [midway] (\chronos@tempa{} #5) -- cycle;
    \else
      \path [/chronos/@llinell/.expand once=\csname chronos@#1@lliw\endcsname] ({#2,0} |- \chronos@border@coord) ++(0pt,\chronos@tempb) ++(0pt,\chronos@llinell@yshift) coordinate (\chronos@tempa{} #4) -- ({#3,0} |- \chronos@tempa{} #4) coordinate  (\chronos@tempa{} #5);
    \fi
    \ifchronos@eventdatessplit
      \ifchronos@yearsonline
        \path [/chronos/@llinell/.expand once=\csname chronos@#1@lliw\endcsname] ({#2,0} |- \chronos@border@coord@inv) -- +(0pt,\chronos@tempc) coordinate (\chronos@tempd{} #4) -| ({#3,0} |- \chronos@border@coord@inv) coordinate [midway] (\chronos@tempd{} #5) -- cycle;
      \else
        \path [/chronos/@llinell/.expand once=\csname chronos@#1@lliw\endcsname] ({#2,0} |- \chronos@border@coord@inv) ++(0pt,\chronos@tempc) ++(0pt,-\chronos@llinell@yshift) coordinate (\chronos@tempd{} #4) -- ({#3,0} |- \chronos@tempd{} #4) coordinate [midway] (\chronos@tempd{} #5);
      \fi
    \fi
  \end{scope}%
}
% END \chronos@creu@llinell (parhad, byw)
% BEGIN \chronos@creu@testun@tag
\NewDocumentCommand \chronos@creu@testun@tag{s O {} m +m}{% make text tag XXX
  % #1 : seren | star
  % #2 : allweddu ychwanegol | additional keys
  % #3 : tag e.g. byw
  % #4 : testun | text
  \ifchronos@phantom
    \relax
  \else
    \expandafter\let\expandafter\chronos@tempa\csname chronos@#3@tikzname\endcsname
    \expandafter\let\expandafter\chronos@tempb\csname chronos@#3@at\endcsname
    \IfBooleanTF{#1}{%
      \edef\chronos@tempa{\csname chronos@#3@tikzname\endcsname-inv}%
      \expandafter\let\expandafter\chronos@tempc\csname chronos@#3@invanchor\endcsname
      \pgfqkeys{/chronos}{%
        chronos@tempa@style/.style={/chronos/event date split},% oedd yshcale=-1,...
        chronos@tempb@style/.style={yshift=2*\chronos@yshift@inv}}%
        \path (\chronos@tempb);
        \pgfgetlastxy {\chronos@templgtha}{\chronos@templgthb}%
        \ifdim\chronos@templgthb>0pt
          \coordinate (chronos@temp@coord) at (\chronos@templgtha,-\chronos@templgthb);
        \else
          \coordinate (chronos@temp@coord) at (\chronos@templgtha,\chronos@templgthb);
        \fi
    }{%
      \expandafter\let\expandafter\chronos@tempc\csname chronos@#3@angor\endcsname
      \pgfqkeys{/chronos}{%
        chronos@tempa@style/.style={#2},
        chronos@tempb@style/.style={#2}}%
      \coordinate (chronos@temp@coord) at (\chronos@tempb);
    }%
    \scoped[/chronos/middle anchorborder]{% ateb Symbol 1: https://tex.stackexchange.com/a/385953/
      % fill opacity=0 -> problem ; fill=none -> dim problem; beth sy'n digwydd?
      \node (testun \chronos@tempa) [/chronos/@testun/.expand once=\csname chronos@#3@lliw\endcsname, anchor=\chronos@tempc, /chronos/.cd,/utils/exec=\pgfkeysalsofrom{\chronos@cadw}, /chronos/chronos@tempb@style, /tikz/.cd, alias=tag \chronos@tempa, alias=text tag \chronos@tempa] at (chronos@temp@coord) {#4};}%
    \ifchronos@tag@cysylltu
      % creu cylch ar y lein | make circle on timeline
      \scoped[/chronos/chronos@cysylltiad@haenen]{\node (cysylltwr chronos \chronos@tempa) [/chronos/@cysylltwr@chronos/.expand once=\csname chronos@#3@lliw\endcsname, alias=chronos connector \chronos@tempa, alias=circle \chronos@tempa, alias=cylch \chronos@tempa] at (\chronos@tempa) {};}%
      \begin{scope}[/chronos/middle anchorborder]% ateb Symbol 1: https://tex.stackexchange.com/a/385953/
        % creu cysylltwyr testun ar y node testun | make text connectors on the text node
        \node (cysylltwr testun \chronos@tempa) [/chronos/@cysylltwr@testun/.expand once=\csname chronos@#3@lliw\endcsname,/chronos/@cysylltwr@testun@prif/.expand once=\csname chronos@#3@lliw\endcsname, alias=text tag connector \chronos@tempa, alias=prif gysylltwr \chronos@tempa, alias=main connector \chronos@tempa, alias=cysylltwr \chronos@tempa0, alias=testun cylch \chronos@tempa, alias=connector \chronos@tempa0] at (testun \chronos@tempa.middle \chronos@tempc) {};
      \end{scope}%
      \path (cysylltwr testun \chronos@tempa);
      \pgfgetlastxy{\chronos@templgtha}{\chronos@templgthb}%
      \path (cysylltwr chronos \chronos@tempa);
      \pgfgetlastxy{\chronos@templgthc}{\chronos@templgthb}%
      \ifdim\chronos@templgtha=\chronos@templgthc\def\chronos@tempe{--}\else\def\chronos@tempe{|-}\fi
      \ifbool{chronos@#3@cysylltiad}{%
        % cysylltu llinell amser i node testun | connect timeline to text node
        \scoped[/chronos/chronos@cysylltiad@haenen]{\draw [/chronos/@cysylltiad/.expand once=\csname chronos@#3@lliw\endcsname] (cysylltwr chronos \chronos@tempa) \chronos@tempe (cysylltwr testun \chronos@tempa) ;}%% oedd .\chronos@tempc
      }{}% ifchronos@#3@cysylltiad
    \fi % \ifchronos@tag@cysylltu
  \fi
%   \edef\chronos@tempa{\csname chronos@#3@tikzname\endcsname}%
%   \edef\chronos@tempb{lliw \csname chronos@#3@tikzname\endcsname}%
%   \colorlet{chronos@temp@lliw}{\chronos@tempb}%
%   \chronos@darparu@lliw{\chronos@tempa}{chronos@temp@lliw}%
%   \draw (cylch \chronos@tempa) |- (cysylltwr testun \chronos@tempa.\chronos@tempc) ;
}
% END \chronos@creu@testun@tag
% BEGIN aliases & (globalised) defaults
\AtEndPreamble{%
  \@ifpackageloaded{memoize}{%
    \mmzset{%
      auto={chronos}{memoize},
    }%
  }{% nid yw hyn yn memoizable byth bynnag
    \pgfkeys{/handlers/.meaning to context/.code={}}%
  }%
  \ifchronos@byw@isod\chronos@byw@isod@rhagtrue\else\chronos@byw@isod@rhagfalse\fi
  \ifchronos@digwyddiad@isod\chronos@digwyddiad@isod@rhagtrue\else\chronos@digwyddiad@isod@rhagfalse\fi
  \ifchronos@parhad@isod\chronos@parhad@isod@rhagtrue\else\chronos@parhad@isod@rhagfalse\fi
  \chronos@lliwiau@cadw@rhag
  \IfExistF \chronosevent{\let\chronosevent\digwyddiad}%
  \IfExistF \chronoslife{\let\chronoslife\byw}%
  \IfExistF \chronosperiod{\let\chronosperiod\parhad}%
  \IfExistF \chronosinfo{\let\chronosinfo\gwybodaeth}%
  \IfExistF \chronostheory{\let\chronostheory\theori}%
  \IfExistF \chronostheorycircle{\let\chronostheorycircle\cylchtheori}%
  \IfExistF \chronosmaintitle{\let\chronosmaintitle\prifdeitl}%
  \IfExistF \chronoscopyright{\let\chronoscopyright\hawlfraint}%
  \IfExistF \chronosshowpreset{\let\chronosshowpreset\chronos@dangos@gosod}%
  \IfExistF \chronosshowcolour{\let\chronosshowcolour\chronos@dangoslliw}%
  \IfExistF \chronosshowcolor{\let\chronosshowcolor\chronos@dangoslliw}%
  \ProvideDocumentCommand \chronosshowfeatures { o }{\IfValueTF {#1} {\chronos@dangos@nodweddion{#1}}{\chronos@dangos@nodweddion@rhag}}%
  \providecolor{chronos show coordinate colour}{named}{chronos@lliw@coord}%
  \providecolor{chronos show node colour}{named}{chronos@lliw@node}%
  \providecolor{chronos show coordinate color}{named}{chronos@lliw@coord}%
  \providecolor{chronos show node color}{named}{chronos@lliw@node}%
  \IfExistF \ceyearlabel {\let\ceyearlabel\chronos@yearce}%
  \IfExistF \bceyearlabel {\let\bceyearlabel\chronos@yearbce}%
  \IfExistF \celabel {\let\celabel\chronos@ce}%
  \IfExistF \bcelabel {\let\bcelabel\chronos@bce}%
  \IfExistF \tlstyle {\let\tlstyle\upshape}%
  \IfExistF \plstyle {\let\plstyle\upshape}%
  \IfExistF \sishape {\DeclareRobustCommand \sishape{\itshape\scshape}}%
  \IfExistF \textsi {\DeclareTextFontCommand{\textsi}{\sishape}}%
  \IfExistF \uishape {\let\uishape\itshape}%
  \IfExistF \textui {\DeclareTextFontCommand{\textui}{\uishape}}%
}
% END aliases
% END macros y ddogfen
\chronos@presetfalse
\endinput
% % ref: Skillman 2023-07-09 https://chat.stackexchange.com/transcript/message/63951272#63951272
% % keys here will be the default if the more specific list doesn't contain the
% % used keys% angen /.style
% \pgfqkeys{/chronos}
%   {
%     .is family
%     ,color = blue
%     ,font = \normalfont
%   }
% \ExplSyntaxOn% angen ~
% \clist_map_inline:nn { event, extended-event, biographical }
%   { \pgfqkeys{/chronos/#1} { .is family, .search also = {/chronos} } }
% \ExplSyntaxOff
% \pgfqkeys{/chronos/event}
%   {
%     color = green
%   }
% \pgfqkeys{/chronos/extended-event}
%   {
%     color = yellow
%     ,font = \bfseries
%   }
% \pgfqkeys{/chronos/biographical}
%   {
%     color = red
%   }
