Gnus development mailing list
 help / color / mirror / Atom feed
* HTML weirdoes
@ 1998-12-02  0:29 Lars Magne Ingebrigtsen
  1998-12-02  1:13 ` Alan Shutko
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-12-02  0:29 UTC (permalink / raw)


How come so many people post HTML containing the following directive?

<BODY bgColor=#ffffff>

I use a white foreground by default, and when one specifies the
background to be white and "forgets" about the foreground, things look 
slightly invisible.

Now, I can set `w3-user-colors-take-precedence', but that's a sledge
hammer.  I think something like
`(setq w3-if-the-background-color-specified-is-the-same-as-my-default-foreground,-then-the-foreground-color-should-be "black")'
would be nice.

Of course, it would be nice if "the same as" would have been "almost
the same as", but that's rather difficult to do, I'd imaging.  And
these HTML weirdoes only post with a pure white background, so "the
same as" would do the trick for me, I think...

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@ifi.uio.no * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-02  0:29 HTML weirdoes Lars Magne Ingebrigtsen
@ 1998-12-02  1:13 ` Alan Shutko
  1998-12-02 18:00 ` Wes Hardaker
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Alan Shutko @ 1998-12-02  1:13 UTC (permalink / raw)
  Cc: ding

>>>>> "L" == Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:

L> How come so many people post HTML containing the following
L> directive?  <BODY bgColor=#ffffff>

Because they're stupid.

(You know, we could have a washing function to do lots of crazy things
to bad HTML....)

-- 
Alan Shutko <ats@acm.org> - By consent of the corrupted
There's a fine line between courage and foolishness.  Too bad it's not a fence.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-02  0:29 HTML weirdoes Lars Magne Ingebrigtsen
  1998-12-02  1:13 ` Alan Shutko
@ 1998-12-02 18:00 ` Wes Hardaker
  1998-12-02 22:24 ` Karl Kleinpaste
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Wes Hardaker @ 1998-12-02 18:00 UTC (permalink / raw)
  Cc: ding

>>>>> On 02 Dec 1998 01:29:10 +0100, Lars Magne Ingebrigtsen <larsi@ifi.uio.no> said:

Lars> How come so many people post HTML containing the following directive?
Lars> <BODY bgColor=#ffffff>

The world is against you?

-- 
"Ninjas aren't dangerous.  They're more afraid of you than you are of them."


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-02  0:29 HTML weirdoes Lars Magne Ingebrigtsen
  1998-12-02  1:13 ` Alan Shutko
  1998-12-02 18:00 ` Wes Hardaker
@ 1998-12-02 22:24 ` Karl Kleinpaste
  1998-12-02 22:32   ` Alan Shutko
  1998-12-03 11:41 ` William M. Perry
  1998-12-03 15:00 ` William M. Perry
  4 siblings, 1 reply; 12+ messages in thread
From: Karl Kleinpaste @ 1998-12-02 22:24 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:
> How come so many people post HTML containing the following directive?
> <BODY bgColor=#ffffff>

Because the world has been using dark ink on light-colored paper for a
few thousand years, and typical monitor contrast is really quite suckful?

(I'm personally fairly offended by Netscrape's medium-gray default bg
-- many things are very unreadable against that blandness.)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-02 22:24 ` Karl Kleinpaste
@ 1998-12-02 22:32   ` Alan Shutko
  1998-12-02 22:51     ` Hrvoje Niksic
  1998-12-02 23:05     ` Karl Kleinpaste
  0 siblings, 2 replies; 12+ messages in thread
From: Alan Shutko @ 1998-12-02 22:32 UTC (permalink / raw)
  Cc: ding

>>>>> "K" == Karl Kleinpaste <karl@justresearch.com> writes:

K> Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:
>> How come so many people post HTML containing the following
>> directive?  <BODY bgColor=#ffffff>

K> Because the world has been using dark ink on light-colored paper
K> for a few thousand years, and typical monitor contrast is really
K> quite suckful?

Then they should specify the dark ink too.  Specifying just bgcolor is
like upgrading all the chalkboards to dry-erase while leaving teachers
with chalk.

-- 
Alan Shutko <ats@acm.org> - By consent of the corrupted
Rudeness is a weak man's imitation of strength.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-02 22:32   ` Alan Shutko
@ 1998-12-02 22:51     ` Hrvoje Niksic
  1998-12-03 13:28       ` Robert Bihlmeyer
  1998-12-02 23:05     ` Karl Kleinpaste
  1 sibling, 1 reply; 12+ messages in thread
From: Hrvoje Niksic @ 1998-12-02 22:51 UTC (permalink / raw)


Alan Shutko <ats@acm.org> writes:

> K> Because the world has been using dark ink on light-colored paper
> K> for a few thousand years, and typical monitor contrast is really
> K> quite suckful?
> 
> Then they should specify the dark ink too.  Specifying just bgcolor
> is like upgrading all the chalkboards to dry-erase while leaving
> teachers with chalk.

Only the trouble is that the users don't "specify" that -- the "smart" 
software does that for them, and it fucks up.  :-(

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Depression is merely anger without enthusiasm.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-02 22:32   ` Alan Shutko
  1998-12-02 22:51     ` Hrvoje Niksic
@ 1998-12-02 23:05     ` Karl Kleinpaste
  1 sibling, 0 replies; 12+ messages in thread
From: Karl Kleinpaste @ 1998-12-02 23:05 UTC (permalink / raw)


Alan Shutko <ats@acm.org> writes:
> Then they should specify the dark ink too.  Specifying just bgcolor is
> like upgrading all the chalkboards to dry-erase while leaving teachers
> with chalk.

I tend to think of the matter as a reminder to the braindead browser
that paper is supposed to be white(-ish), even though the folks at
Netscrape forgot that fact, whereas the ink will still almost always
default to black, and so needs no re-specification.  You folks who are
using metaphorical "chalk" on a "blackboard" are the exception, not
the rule.

Tastes vary, and much too wildly for safety's sake.  Hence Gnus'
configurability, after all.  Ensure your own colors get used
everywhere, and the problem simply disappears.  It may be a
sledgehammer, but it works every time.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-02  0:29 HTML weirdoes Lars Magne Ingebrigtsen
                   ` (2 preceding siblings ...)
  1998-12-02 22:24 ` Karl Kleinpaste
@ 1998-12-03 11:41 ` William M. Perry
  1998-12-03 15:00 ` William M. Perry
  4 siblings, 0 replies; 12+ messages in thread
From: William M. Perry @ 1998-12-03 11:41 UTC (permalink / raw)
  Cc: ding

Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:

> How come so many people post HTML containing the following directive?

  because the vast majority of MUAs suck? :)

-Bill P.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-02 22:51     ` Hrvoje Niksic
@ 1998-12-03 13:28       ` Robert Bihlmeyer
  0 siblings, 0 replies; 12+ messages in thread
From: Robert Bihlmeyer @ 1998-12-03 13:28 UTC (permalink / raw)


Hi,

>>>>> On 02 Dec 1998 23:51:22 +0100
>>>>> Hrvoje Niksic <hniksic@srce.hr> said:

 Hrvoje> Only the trouble is that the users don't "specify" that --
 Hrvoje> the "smart" software does that for them, and it fucks up. :-(

I sometimes wish the various washing functions we have to cope with
broken software could be configured to automatically send complaints
to the senders.

Other times I prefer to weep silently.

	Robbe

-- 
Robert Bihlmeyer	reads: Deutsch, English, MIME, Latin-1, NO SPAM!
<robbe@orcus.priv.at>	<http://stud2.tuwien.ac.at/~e9426626/sig.html>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-02  0:29 HTML weirdoes Lars Magne Ingebrigtsen
                   ` (3 preceding siblings ...)
  1998-12-03 11:41 ` William M. Perry
@ 1998-12-03 15:00 ` William M. Perry
  1998-12-04  1:04   ` Lars Magne Ingebrigtsen
  4 siblings, 1 reply; 12+ messages in thread
From: William M. Perry @ 1998-12-03 15:00 UTC (permalink / raw)
  Cc: ding

Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:

> How come so many people post HTML containing the following directive?
> 
> <BODY bgColor=#ffffff>
> 
> I use a white foreground by default, and when one specifies the
> background to be white and "forgets" about the foreground, things look
> slightly invisible.
> 
> Now, I can set `w3-user-colors-take-precedence', but that's a sledge
> hammer.  I think something like
> `(setq w3-if-the-background-color-specified-is-the-same-as-my-default-foreground,-then-the-foreground-color-should-be "black")'
> would be nice.
> 
> Of course, it would be nice if "the same as" would have been "almost the
> same as", but that's rather difficult to do, I'd imaging.  And these HTML
> weirdoes only post with a pure white background, so "the same as" would
> do the trick for me, I think...

What about this patch?  It will try to determine which of 'black' or
'white' to use on top of the appropriate color.  If they specify the
foreground but not the back, and it would be useless, we ignore it.

Note that you could redefine w3-display-colors-too-close-p to be much
smarter to get you the fuzzy matching you want.  This patch works for me at 
least in XEmacs - haven't tested Emacs yet, and need to get to work, but
it's just messing with variables before the version-specific stuff, so it
should be fine.

I tried this with

<body bgcolor="my-foreground-color">

and

<body text="my-background-color">

And the pages were readable.

Anyone, anyone?

-Bill P.

Index: w3-display.el
===================================================================
RCS file: /usr/people/wmperry/.cvs/w3/lisp/w3-display.el,v
retrieving revision 1.229
diff -c -w -c -w -r1.229 w3-display.el
*** w3-display.el	1998/12/01 21:43:31	1.229
--- w3-display.el	1998/12/03 14:57:22
***************
*** 251,256 ****
--- 251,307 ----
  	  (setq voice nil))
  	(or voice (car w3-active-voices)))))
  
+ (defun w3-display-colors-too-close-p (foreground background)
+   ;; This algorithm could be _MUCH_ better. :)
+   ;;
+   ;; Perhaps doing something along the lines of converting them both
+   ;; to grayscale values, then considering them worthless if they are
+   ;; within some user-configurable delta?
+   (equal foreground background))
+ 
+ (defun w3-display-background-useless-p (color)
+   (let ((foreground-color (font-color-rgb-components
+ 			   (if (fboundp 'face-foreground-name)
+ 			       (face-foreground-name 'default)
+ 			     (face-foreground 'default))))
+ 	(background-color (font-color-rgb-components color)))
+     (w3-display-colors-too-close-p foreground-color background-color)))
+ 
+ (defun w3-display-foreground-useless-p (color)
+   (let ((background-color (font-color-rgb-components
+ 			   (if (fboundp 'face-background-name)
+ 			       (face-background-name 'default)
+ 			     (face-background 'default))))
+ 	(foreground-color (font-color-rgb-components color)))
+     (w3-display-colors-too-close-p foreground-color background-color)))
+ 
+ (defun w3-display-infer-contrasting-color (color)
+   ;; Simple little algorithm suggested by Adam Hammer
+   ;; <hammer@math.purdue.edu>
+   ;; 
+   ;; Extremes are black and white, so make those the two
+   ;; choices. Convert the color to grayscale (0.299R + 0.587G +
+   ;; 0.114B) and then choose either black or white depending upon
+   ;; which one is furthest away from the grayscale color calculated.
+   ;;
+   ;; Found via research? Tested?  Haha.
+   (let* ((rgb (font-color-rgb-components color))
+ 	 (r (nth 0 rgb))
+ 	 (g (nth 1 rgb))
+ 	 (b (nth 2 rgb))
+ 	 (grayscale nil)
+ 	 (white nil)
+ 	 (black nil))
+     (if (and (<= r 255) (<= g 255) (<= b 255))
+ 	(setq max 255)
+       (setq max 65535))
+     (setq grayscale (+ (* 0.299 r) (* 0.587 g) (* 0.114 b))
+ 	  black (- max grayscale)
+ 	  white grayscale)
+     (if (> white black)
+ 	"black"
+       "white")))
+ 
  (defun w3-make-face-emacs19 (name &optional doc-string temporary)
    "Defines and returns a new FACE described by DOC-STRING.
  If the face already exists, it is unmodified."
***************
*** 2282,2287 ****
--- 2333,2364 ----
  		     (progn
  		       (setq fore (w3-fix-color (w3-get-attribute 'text)))
  		       (setf (car w3-face-color) fore)))
+ 
+ 		 ;; Here we do some sanity checking of the colors
+ 		 ;; selected by the author.
+ 
+ 		 ;; If they specify the foreground and not the
+ 		 ;; background, _AND_ we determine the contrast is not
+ 		 ;; enough, then don't honor the foreground at all.
+ 		 (if (and fore (not back) (not pixm) (w3-display-foreground-useless-p fore))
+ 		     (setq fore nil))
+ 
+ 		 ;; If we wanted to be really weird, we could infer
+ 		 ;; the background for them instead of just ignoring
+ 		 ;; the foreground.  But I think this might be too
+ 		 ;; shocking for the average user. :)
+ 		 ;; 
+ 		 ;; (setq back (w3-display-infer-contrasting-color fore)))
+ 
+ 		 ;; If they specify the background and not the
+ 		 ;; foreground, _AND_ we determine the contrast is not
+ 		 ;; enough, then infer a new foreground color.
+ 		 (if (and back (not pixm) (not fore) (w3-display-background-useless-p back))
+ 		     (setq fore (w3-display-infer-contrasting-color back)))
+ 
+ 		 (setf (car w3-face-color) fore)
+ 		 (setf (car w3-face-background-color) back)
+ 
  		 (if (not font-running-xemacs)
  		     (setq w3-display-background-properties (cons fore back))
  		   (if pixm


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-03 15:00 ` William M. Perry
@ 1998-12-04  1:04   ` Lars Magne Ingebrigtsen
  1998-12-04 14:33     ` William M. Perry
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-12-04  1:04 UTC (permalink / raw)


wmperry@aventail.com (William M. Perry) writes:

> What about this patch?  It will try to determine which of 'black' or
> 'white' to use on top of the appropriate color.

This patch fixes things for me.  Now I can read what those morons who
send me HTML mail write.  Er.  *Argh*!  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: HTML weirdoes
  1998-12-04  1:04   ` Lars Magne Ingebrigtsen
@ 1998-12-04 14:33     ` William M. Perry
  0 siblings, 0 replies; 12+ messages in thread
From: William M. Perry @ 1998-12-04 14:33 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> wmperry@aventail.com (William M. Perry) writes:
> 
> > What about this patch?  It will try to determine which of 'black' or
> > 'white' to use on top of the appropriate color.
> 
> This patch fixes things for me.  Now I can read what those morons who
> send me HTML mail write.  Er.  *Argh*!  :-)

  Yeah, it does have that drawback. :(

-bp


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1998-12-04 14:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-12-02  0:29 HTML weirdoes Lars Magne Ingebrigtsen
1998-12-02  1:13 ` Alan Shutko
1998-12-02 18:00 ` Wes Hardaker
1998-12-02 22:24 ` Karl Kleinpaste
1998-12-02 22:32   ` Alan Shutko
1998-12-02 22:51     ` Hrvoje Niksic
1998-12-03 13:28       ` Robert Bihlmeyer
1998-12-02 23:05     ` Karl Kleinpaste
1998-12-03 11:41 ` William M. Perry
1998-12-03 15:00 ` William M. Perry
1998-12-04  1:04   ` Lars Magne Ingebrigtsen
1998-12-04 14:33     ` William M. Perry

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).