ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Hans Hagen <j.hagen@freedom.nl>
Subject: [NTG-context] Re: colors for links
Date: Sat, 14 Oct 2023 14:19:03 +0200	[thread overview]
Message-ID: <3f8761de-f24c-2e2f-b91f-d00dcc0de258@freedom.nl> (raw)
In-Reply-To: <e7bd5e99-dd6c-1d46-ebbb-a34e2133b0d2@gmx.es>

[-- Attachment #1: Type: text/plain, Size: 3214 bytes --]

On 10/12/2023 3:14 PM, Pablo Rodriguez wrote:
> Hi Hans,
> 
> I have the following source, which tries to resemble three kinds of links:
> 
>      \setupinteraction[state=start, style=, focus=standard]
> 
>      \def\inone#1{%
>        \start\setupinteraction[color=darkgreen]%
>        \enabledirectives[references.border=darkgreen]%
>        \goto{#1}[url(#1)]\stop}
>      \def\intwo#1{%
>        \start\setupinteraction[color=darkred]%
>        \enabledirectives[references.border=darkred]%
>        \goto{#1}[url(#1)]\stop}
>      \def\inthree#1{%
>        \start\setupinteraction[color=darkblue]%
>        \enabledirectives[references.border=darkblue]%
>        \goto{#1}[url(#1)]\stop}
> 
>      \starttext
>      \startTEXpage[offset=1dk, align=middle]
>      \inone{one}\blank
>      \intwo{two}\blank
>      \inthree{three}\blank
>      \stopTEXpage
>      \chapter[one]{First chapter}
>      \chapter[two]{Second chapter}
>      \chapter[three]{Second chapter}
>      \stoptext
> 
> I see that the directive for link borders only allows one color for
> links per document.
> 
> In my real-world documents, I need to make three different border links:
> for destinations inside the document (/GoTo), for destinations in other
> documents (/GoToR or /GoToE) and for external destinations (/URI).
> 
> With the current document I write now, I have over a hundred links in
> twenty pages. Being able to visually distinguish each link helps
> interaction with the document (reading or even writing it).
> 
> Would it be possible that \setupinteraction could have a bordercolor
> key, such as the color one?
All is possible but not all should be done, especially not features that 
mostly serve a few viewers (like acrobat) and don't really relate to 
typesetting.

That said, we can add some styling. First of all, you can use a bit of 
abstraction

\defineinteraction[one]  [color=darkgreen,style=\underbar]
\defineinteraction[two]  [color=darkred,  style=\underbar]
\defineinteraction[three][color=darkblue, style=\underbar]

\def\inone#1{%
   \start\setinteraction[one]%
   \goto{#1}[url(#1)]\stop}
\def\intwo#1{%
   \start\setinteraction[two]%
   \goto{#1}[url(#1)]\stop}
\def\inthree#1{%
   \start\setinteraction[three]%
   \goto{#1}[url(#1)]\stop}

which already might help you. To make it easier I'll add \namedgoto do 
that one can say:

\def\inone  #1{\namedgoto[#1]{#1}[url(#1)]}
\def\intwo  #1{\namedgoto[#1]{#1}[url(#1)]}
\def\inthree#1{\namedgoto[#1]{#1}[url(#1)]}

I'll also add \outline and \outlined

\defineinteraction[one]  [color=darkgreen,style=\outlined]%
\defineinteraction[two]  [color=darkred,  style=\outline]%
\defineinteraction[three][color=darkblue, style=\outlined]%

which of course you then will wikify ...

I attached an example but there is no upload (will happen when the build 
is running again because I can't make osx bins here).

hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

[-- Attachment #2: oeps.pdf --]
[-- Type: application/pdf, Size: 8350 bytes --]

[-- Attachment #3: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2023-10-14 12:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 13:14 [NTG-context] " Pablo Rodriguez
2023-10-14 12:19 ` Hans Hagen via ntg-context [this message]
2023-10-14 17:55   ` [NTG-context] " Pablo Rodriguez
2023-10-14 20:47     ` Hans Hagen via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f8761de-f24c-2e2f-b91f-d00dcc0de258@freedom.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@freedom.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).