	subroutine setclrs
	common /my_colors/ncolor,hsi(3,30),nc1
	COMMON /CNTR/ CMIN,CMAX,CDEL,cmid,itype
	if(itype.eq.1) then
c
c	itype=1: velocity
c
	if(cdel.le.0.0) cdel=30.
	call velclrs(nmid)
	elseif(itype.eq.2) then
c
c	itype=2: temperature
c
	if(cdel.le.0.0) cdel=1.
	if(cmid.eq.0.0) cmid=20.
	call tmpclrs(nmid)
	elseif(itype.eq.3) then
c
c	itype=3: echo amp
c
	if(cdel.le.0.0) cdel=6.
	cmid=0.0
	call ampclrs(nmid)
	elseif(itype.eq.9) then
c
c	itype=9: read in colors
c
	ncolor=(cmax-cmin)/cdel+1.1
	nc1=1
	call get_cclrs
	return
	endif
c
	nc1=(cmin-cmid)/cdel+nmid+1.1
	if(nc1.lt.1) then
	nc1=1
	cmin=cmid-nmid*cdel
	endif
	ncolor=ncolor-nc1+1
	do n=1,ncolor
	clev=cmin+(n-1)*cdel
	if(clev.gt.cmax) then
	ncolor=n-1
	return
	endif
c	write(6,11) clev,(hsi(i,n+nc1-1),i=1,3)
11	format(4f8.2)
	enddo
	return
	end
	subroutine get_cclrs
c
c	read colors
c
	common /my_colors/ncolor,hsi(3,30),nc1
	COMMON /CNTR/ CMIN,CMAX,CDEL,cmid,itype
	character*10 lcolor(30),color4*4
	read(5,*) cmid,(lcolor(n),n=1,ncolor)
	do n=1,ncolor
	color4=lcolor(n)(1:4)
	call clrhsi(color4,hsi(1,n),hsi(2,n),hsi(3,n))
	if(lcolor(n)(5:7).ne.'   ') then
	read(lcolor(n)(5:7),11) fact
11	format(f3.1)
	hsi(2,n)=fact
	if(hsi(2,n).gt.1.0) hsi(2,n)=1.0
	endif
	if(lcolor(n)(8:10).ne.'   ') then
	read(lcolor(n)(8:10),11) fact
	hsi(3,n)=fact
	if(hsi(3,n).gt.1.0) hsi(3,n)=1.0
	endif
	enddo
	return
	end
	subroutine velclrs(nlo)
	common /my_colors/ncolor,hsi(3,30),nc1
c
c	colors for velocity
c
	ncolor=16
	nlo=ncolor/2
	cinc=.5/6
	do n=1,ncolor
	hsi(2,n)=.95
	hsi(3,n)=.95
	enddo
	hsi(3,1)=.5
	hsi(1,1)=3.0
	do n=2,7
	hsi(1,n)=3.0-(n-2)*cinc
	enddo
	hsi(1,8)=2.5
	hsi(2,8)=.5
	hsi(1,9)=1.5
	hsi(2,9)=.5
	do n=10,15
	hsi(1,n)=1.5-(n-10)*cinc
	enddo
	hsi(3,16)=.5
	hsi(1,16)=1.0
	return
	end
	subroutine tmpclrs(nlo)
	COMMON /CNTR/ CMIN,CMAX,CDEL,cmid,itype
	common /my_colors/ncolor,hsi(3,30),nc1
c
c	colors for temperature
c
	ncolor=25
	nlo=14
	cinc=.7/float(nlo-1)
	nfact=nlo/(cmid-cmin)*cdel
	if(nfact.lt.1) nfact=1 
	cinc=cinc*nfact
	flo=nlo
	do n=1,nlo
	hsi(2,nlo-n+1)=amin1(.5+n*nfact*.5/flo,1.0)
	hsi(3,nlo-n+1)=amax1(1.-n*nfact*.4/flo,0.6)
	hsi(1,nlo-n+1)=2.4+(n-1)*cinc
	enddo
	hi=ncolor-nlo
	cinc=.7/hi
	nfact=hi/(cmax-cmid)*cdel
	if(nfact.gt.1) cinc=cinc*nfact
	do n=nlo+1,ncolor
	hsi(2,n)=amin1(.3+(n-nlo-1)*.7/hi*nfact,1.0)
c	hsi(2,n)=amin1(.5+(n-nlo-1)*.5/hi*nfact,1.0)
c	if(mod(n,2).eq.0) hsi(2,n)=hsi(2,n)*.5
c	hsi(3,n)=amax1(1.-(n-nlo-1)*.4/hi*nfact,0.6)
	hsi(3,n)=amax1(1.-(n-nlo-1)*.6/hi*nfact,0.4)
	hsi(1,n)=3.4+(n-nlo-1)*cinc
	if(hsi(1,n).gt.3.5) hsi(1,n)=hsi(1,n)-3.0
	enddo
	return
	end
	subroutine ampclrs(nlo)
	common /my_colors/ncolor,hsi(3,30),nc1
c
c	colors for echo amplitude
c
	ncolor=21
	nlo=1	
	cinc=2.5/float(ncolor-1)
	fclr=ncolor
	hsi(2,1)=1.
	hsi(3,1)=1.
	hsi(1,1)=5.0
	do n=2,ncolor
	hsi(1,n)=3.0-(n-1)*cinc
	if(n.le.11) then
	hsi(2,n)=1.-n*.6/fclr
	hsi(3,n)=.5+(n-1)*.5/fclr
	else
	hsi(2,n)=1.-(ncolor-n)*.6/fclr
	hsi(3,n)=.5+(ncolor-n)*.5/fclr
	endif
	enddo
	hsi(2,2)=.2
	hsi(3,2)=.9
	return
	end
